From 3e47883c412a6610bfd407bd36749c8688404dfc Mon Sep 17 00:00:00 2001 From: Darrell Wright Date: Fri, 24 Nov 2017 23:24:19 -0500 Subject: [PATCH] Added compile option BUILD_STATIC that defaults to ON to build static libraries. Set to off to build shared --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dd0d34c..b5966fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,7 @@ find_package( Threads REQUIRED ) option( USE_SYSTEM_TZ_DB "Use the operating system's timezone database" OFF ) option( USE_TZ_DB_IN_DOT "Save the timezone database in the current folder" OFF ) +option( BUILD_STATIC "Build a static version of library" ON ) if( USE_SYSTEM_TZ_DB ) add_definitions( -DUSE_AUTOLOAD=0 ) @@ -45,7 +46,11 @@ set( HEADER_FILES ${HEADER_FOLDER}/date/tz_private.h ) -add_library( tz SHARED ${HEADER_FILES} ${SOURCE_FOLDER}/tz.cpp ) +if( BUILD_STATIC ) + add_library( tz STATIC ${HEADER_FILES} ${SOURCE_FOLDER}/tz.cpp ) +else( ) + add_library( tz SHARED ${HEADER_FILES} ${SOURCE_FOLDER}/tz.cpp ) +endif( ) set_property(TARGET tz PROPERTY CXX_STANDARD 14) target_link_libraries( tz ${CMAKE_THREAD_LIBS_INIT} ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} )