From 4c9d851ebaa7e44f642449375b04846adffe0b8f Mon Sep 17 00:00:00 2001 From: Peter Steinbach Date: Tue, 15 Dec 2015 16:27:46 +0100 Subject: added static build target for OSX and Linux to cmake --- cmake_unofficial/CMakeLists.txt | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/cmake_unofficial/CMakeLists.txt b/cmake_unofficial/CMakeLists.txt index 502a43e..57f7947 100644 --- a/cmake_unofficial/CMakeLists.txt +++ b/cmake_unofficial/CMakeLists.txt @@ -43,14 +43,26 @@ if(BUILD_TOOLS) endif() if(BUILD_LIBS) - add_library(liblz4 SHARED ${LZ4_SRCS_LIB}) - + + + SET(LIBS_TARGETS "") + IF(NOT WIN32) + add_library(liblz4 SHARED ${LZ4_SRCS_LIB}) + add_library(liblz4_static STATIC ${LZ4_SRCS_LIB}) + SET_TARGET_PROPERTIES(liblz4_static PROPERTIES OUTPUT_NAME lz4) + SET(LIBS_TARGETS liblz4 liblz4_static) + ELSE(NOT WIN32) + add_library(liblz4 STATIC ${LZ4_SRCS_LIB}) + SET(LIBS_TARGETS liblz4) + ENDIF(NOT WIN32) + set_target_properties(liblz4 PROPERTIES OUTPUT_NAME lz4 SOVERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}" ) - install(TARGETS liblz4 + install(TARGETS ${LIBS_TARGETS} + RUNTIME DESTINATION lib #on Windows: cmake considers dlls as runtime component LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) -- cgit v0.12