From c906c230fb403ff190d1730365026603f4c2c0d9 Mon Sep 17 00:00:00 2001 From: Antonin Descampe Date: Sun, 5 Dec 2010 15:19:57 +0000 Subject: [PATCH] revert to previous behaviour for cmake: builds (and links) dynamically by default. Static build only if -DBUILD_SHARED_LIBS is set to OFF. --- codec/CMakeLists.txt | 9 +-------- libjp3dvm/CMakeLists.txt | 43 ++++++++++------------------------------ 2 files changed, 11 insertions(+), 41 deletions(-) diff --git a/codec/CMakeLists.txt b/codec/CMakeLists.txt index bf08bc00..9e35ea7a 100644 --- a/codec/CMakeLists.txt +++ b/codec/CMakeLists.txt @@ -24,17 +24,10 @@ IF(DONT_HAVE_GETOPT) ) ENDIF(DONT_HAVE_GETOPT) - -# Do the proper thing when building static...if only there was configured -# headers or def files instead -ADD_DEFINITIONS(-DOPJ_STATIC) - -#FIND_PACKAGE(TIFF REQUIRED) - # Loop over all executables: FOREACH(exe jp3d_to_volume volume_to_jp3d) ADD_EXECUTABLE(${exe} ${exe}.c ${common_SRCS}) - TARGET_LINK_LIBRARIES(${exe} ${OPENJPEG_LIBRARY_NAME}_JP3D.static) # ${TIFF_LIBRARIES}) + TARGET_LINK_LIBRARIES(${exe} ${OPENJPEG_LIBRARY_NAME}_JP3D) # ${TIFF_LIBRARIES}) # On unix you need to link to the math library: IF(UNIX) TARGET_LINK_LIBRARIES(${exe} m) diff --git a/libjp3dvm/CMakeLists.txt b/libjp3dvm/CMakeLists.txt index 4e9d241f..7ab01fdc 100644 --- a/libjp3dvm/CMakeLists.txt +++ b/libjp3dvm/CMakeLists.txt @@ -14,51 +14,28 @@ IF(LCMS_INCLUDE_DIR) INCLUDE_DIRECTORIES( ${LCMS_INCLUDE_DIR} ) ENDIF(LCMS_INCLUDE_DIR) -# Build the static library +# Build the library IF(WIN32) - ADD_DEFINITIONS(-DOPJ_STATIC) + IF(BUILD_SHARED_LIBS) + ADD_DEFINITIONS(-DOPJ_EXPORTS) + ELSE(BUILD_SHARED_LIBS) + ADD_DEFINITIONS(-DOPJ_STATIC) + ENDIF(BUILD_SHARED_LIBS) 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 +ADD_LIBRARY(${OPENJPEG_LIBRARY_NAME}_JP3D ${JP3DVM_SRCS}) +SET_TARGET_PROPERTIES(${OPENJPEG_LIBRARY_NAME}_JP3D PROPERTIES VERSION 1.3.0 SOVERSION 1) IF(LCMS_LIB) -TARGET_LINK_LIBRARIES(${OPENJPEG_LIBRARY_NAME}_JP3D.static ${LCMS_LIB}) + TARGET_LINK_LIBRARIES(${OPENJPEG_LIBRARY_NAME}_JP3D ${LCMS_LIB}) ENDIF(LCMS_LIB) # Install library -INSTALL(TARGETS ${OPENJPEG_LIBRARY_NAME}_JP3D.static +INSTALL(TARGETS ${OPENJPEG_LIBRARY_NAME}_JP3D 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(FILES openjpeg.h DESTINATION ${OPENJPEG_INSTALL_INCLUDE_DIR}/openjpeg3d-1.3