changed cmake behaviour: executables are now always statically linked. When -DBUIL_SHARED_LIBS option is ON (the default), the shared versions of the libraries are also built (but executables remain linked against the static libraries).
This commit is contained in:
parent
fb6d84918d
commit
e33c029fdb
|
@ -27,16 +27,14 @@ ENDIF(DONT_HAVE_GETOPT)
|
||||||
|
|
||||||
# Do the proper thing when building static...if only there was configured
|
# Do the proper thing when building static...if only there was configured
|
||||||
# headers or def files instead
|
# headers or def files instead
|
||||||
IF(NOT BUILD_SHARED_LIBS)
|
ADD_DEFINITIONS(-DOPJ_STATIC)
|
||||||
ADD_DEFINITIONS(-DOPJ_STATIC)
|
|
||||||
ENDIF(NOT BUILD_SHARED_LIBS)
|
|
||||||
|
|
||||||
#FIND_PACKAGE(TIFF REQUIRED)
|
#FIND_PACKAGE(TIFF REQUIRED)
|
||||||
|
|
||||||
# Loop over all executables:
|
# Loop over all executables:
|
||||||
FOREACH(exe jp3d_to_volume volume_to_jp3d)
|
FOREACH(exe jp3d_to_volume volume_to_jp3d)
|
||||||
ADD_EXECUTABLE(${exe} ${exe}.c ${common_SRCS})
|
ADD_EXECUTABLE(${exe} ${exe}.c ${common_SRCS})
|
||||||
TARGET_LINK_LIBRARIES(${exe} ${OPJ_PREFIX}openjp3dvm) # ${TIFF_LIBRARIES})
|
TARGET_LINK_LIBRARIES(${exe} ${OPENJPEG_LIBRARY_NAME}_JP3D.static) # ${TIFF_LIBRARIES})
|
||||||
# On unix you need to link to the math library:
|
# On unix you need to link to the math library:
|
||||||
IF(UNIX)
|
IF(UNIX)
|
||||||
TARGET_LINK_LIBRARIES(${exe} m)
|
TARGET_LINK_LIBRARIES(${exe} m)
|
||||||
|
|
|
@ -10,25 +10,54 @@ SET(JP3DVM_SRCS
|
||||||
bio.c cio.c dwt.c event.c jp3d.c jp3d_lib.c mct.c mqc.c openjpeg.c pi.c raw.c t1.c t1_3d.c t2.c tcd.c tgt.c volume.c
|
bio.c cio.c dwt.c event.c jp3d.c jp3d_lib.c mct.c mqc.c openjpeg.c pi.c raw.c t1.c t1_3d.c t2.c tcd.c tgt.c volume.c
|
||||||
)
|
)
|
||||||
|
|
||||||
# Pass proper definition to preprocessor to generate shared lib
|
IF(LCMS_INCLUDE_DIR)
|
||||||
IF(WIN32)
|
INCLUDE_DIRECTORIES( ${LCMS_INCLUDE_DIR} )
|
||||||
IF(BUILD_SHARED_LIBS)
|
ENDIF(LCMS_INCLUDE_DIR)
|
||||||
ADD_DEFINITIONS(-DOPJ_EXPORTS)
|
|
||||||
ELSE(BUILD_SHARED_LIBS)
|
|
||||||
ADD_DEFINITIONS(-DOPJ_STATIC)
|
|
||||||
ENDIF(BUILD_SHARED_LIBS)
|
|
||||||
ENDIF(WIN32)
|
|
||||||
|
|
||||||
# Create the library
|
# Build the static library
|
||||||
#ADD_LIBRARY(${OPENJPEG_LIBRARY_NAME} ${OPENJPEG_SRCS})
|
IF(WIN32)
|
||||||
ADD_LIBRARY(${OPJ_PREFIX}openjp3dvm ${JP3DVM_SRCS})
|
ADD_DEFINITIONS(-DOPJ_STATIC)
|
||||||
SET_TARGET_PROPERTIES(${OPJ_PREFIX}openjp3dvm
|
ENDIF(WIN32)
|
||||||
|
ADD_LIBRARY(${OPENJPEG_LIBRARY_NAME}_JP3D.static STATIC ${JP3DVM_SRCS})
|
||||||
|
SET_TARGET_PROPERTIES(${OPENJPEG_LIBRARY_NAME}_JP3D.static PROPERTIES OUTPUT_NAME ${OPENJPEG_LIBRARY_NAME}_JP3D)
|
||||||
|
SET_TARGET_PROPERTIES(${OPENJPEG_LIBRARY_NAME}_JP3D.static
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
VERSION 1.3.0
|
VERSION 1.3.0
|
||||||
SOVERSION 1)
|
SOVERSION 1)
|
||||||
|
IF(LCMS_LIB)
|
||||||
|
TARGET_LINK_LIBRARIES(${OPENJPEG_LIBRARY_NAME}_JP3D.static ${LCMS_LIB})
|
||||||
|
ENDIF(LCMS_LIB)
|
||||||
|
|
||||||
# Install library
|
# Install library
|
||||||
INSTALL_TARGETS(/lib/ ${OPJ_PREFIX}openjp3dvm)
|
INSTALL(TARGETS ${OPENJPEG_LIBRARY_NAME}_JP3D.static
|
||||||
|
DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
|
||||||
|
)
|
||||||
|
|
||||||
|
# If BUILD_SHARED_LIBS is ON, also build the shared library
|
||||||
|
IF(BUILD_SHARED_LIBS)
|
||||||
|
# replace flag for static build with flag for shared build
|
||||||
|
IF(WIN32)
|
||||||
|
REMOVE_DEFINITIONS(-DOPJ_STATIC)
|
||||||
|
ADD_DEFINITIONS(-DOPJ_EXPORTS)
|
||||||
|
ENDIF(WIN32)
|
||||||
|
# Create the shared library
|
||||||
|
ADD_LIBRARY(${OPENJPEG_LIBRARY_NAME}_JP3D.shared SHARED ${JP3DVM_SRCS})
|
||||||
|
SET_TARGET_PROPERTIES(${OPENJPEG_LIBRARY_NAME}_JP3D.shared PROPERTIES OUTPUT_NAME ${OPENJPEG_LIBRARY_NAME}_JP3D)
|
||||||
|
SET_TARGET_PROPERTIES(${OPENJPEG_LIBRARY_NAME}_JP3D.shared
|
||||||
|
PROPERTIES
|
||||||
|
VERSION 1.3.0
|
||||||
|
SOVERSION 1)
|
||||||
|
IF(LCMS_LIB)
|
||||||
|
TARGET_LINK_LIBRARIES(${OPENJPEG_LIBRARY_NAME}_JP3D.shared ${LCMS_LIB})
|
||||||
|
ENDIF(LCMS_LIB)
|
||||||
|
# Install library
|
||||||
|
INSTALL(TARGETS ${OPENJPEG_LIBRARY_NAME}_JP3D.shared
|
||||||
|
DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
|
||||||
|
)
|
||||||
|
IF(WIN32)
|
||||||
|
REMOVE_DEFINITIONS(-DOPJ_EXPORTS)
|
||||||
|
ENDIF(WIN32)
|
||||||
|
ENDIF(BUILD_SHARED_LIBS)
|
||||||
|
|
||||||
# Install includes files
|
# Install includes files
|
||||||
INSTALL(FILES openjpeg.h
|
INSTALL(FILES openjpeg.h
|
||||||
|
|
Loading…
Reference in New Issue