From 1329b3240aafb1b31328091eb6f7720787b391be Mon Sep 17 00:00:00 2001 From: Jeroen Ooms Date: Fri, 16 Jun 2017 13:27:19 +0200 Subject: [PATCH 1/2] build both shared and static library --- src/lib/openjp2/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/openjp2/CMakeLists.txt b/src/lib/openjp2/CMakeLists.txt index ad77c6e3..635cc29f 100644 --- a/src/lib/openjp2/CMakeLists.txt +++ b/src/lib/openjp2/CMakeLists.txt @@ -87,7 +87,9 @@ if(WIN32) add_definitions(-DOPJ_STATIC) endif() endif() -add_library(${OPENJPEG_LIBRARY_NAME} ${OPENJPEG_SRCS}) +add_library(${OPENJPEG_LIBRARY_NAME} SHARED ${OPENJPEG_SRCS}) +add_library(openjp2_static STATIC ${OPENJPEG_SRCS}) +set_target_properties(openjp2_static PROPERTIES OUTPUT_NAME ${OPENJPEG_LIBRARY_NAME}) if(UNIX) target_link_libraries(${OPENJPEG_LIBRARY_NAME} m) endif() From a0839cca24e19f1f0906e30ee1009ce89e4942b4 Mon Sep 17 00:00:00 2001 From: Jeroen Ooms Date: Fri, 16 Jun 2017 13:58:25 +0200 Subject: [PATCH 2/2] only build both static and dynamic on non-windows --- src/lib/openjp2/CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/lib/openjp2/CMakeLists.txt b/src/lib/openjp2/CMakeLists.txt index 635cc29f..501fa6f9 100644 --- a/src/lib/openjp2/CMakeLists.txt +++ b/src/lib/openjp2/CMakeLists.txt @@ -86,10 +86,14 @@ if(WIN32) else() add_definitions(-DOPJ_STATIC) endif() + add_library(${OPENJPEG_LIBRARY_NAME} ${OPENJPEG_SRCS}) +else() + # Builds both static and dynamic libs + add_library(${OPENJPEG_LIBRARY_NAME} SHARED ${OPENJPEG_SRCS}) + add_library(openjp2_static STATIC ${OPENJPEG_SRCS}) + set_target_properties(openjp2_static PROPERTIES OUTPUT_NAME ${OPENJPEG_LIBRARY_NAME}) endif() -add_library(${OPENJPEG_LIBRARY_NAME} SHARED ${OPENJPEG_SRCS}) -add_library(openjp2_static STATIC ${OPENJPEG_SRCS}) -set_target_properties(openjp2_static PROPERTIES OUTPUT_NAME ${OPENJPEG_LIBRARY_NAME}) + if(UNIX) target_link_libraries(${OPENJPEG_LIBRARY_NAME} m) endif()