2017-11-24 21:34:36 -05:00
|
|
|
cmake_minimum_required( VERSION 2.8.12 )
|
|
|
|
|
|
|
|
project( date_prj )
|
|
|
|
|
2017-11-24 23:07:39 -05:00
|
|
|
find_package( Threads REQUIRED )
|
2017-11-24 21:34:36 -05:00
|
|
|
|
|
|
|
|
2017-11-24 23:07:39 -05:00
|
|
|
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 )
|
2017-11-24 21:34:36 -05:00
|
|
|
|
|
|
|
if( USE_SYSTEM_TZ_DB )
|
|
|
|
add_definitions( -DUSE_AUTOLOAD=0 )
|
|
|
|
add_definitions( -DHAS_REMOTE_API=0 )
|
|
|
|
add_definitions( -DUSE_OS_TZDB=1 )
|
|
|
|
else( )
|
2017-11-24 23:07:39 -05:00
|
|
|
add_definitions( -DUSE_AUTOLOAD=1 )
|
|
|
|
add_definitions( -DHAS_REMOTE_API=1 )
|
|
|
|
add_definitions( -DUSE_OS_TZDB=0 )
|
2017-11-24 21:34:36 -05:00
|
|
|
find_package( CURL REQUIRED )
|
|
|
|
find_package( OpenSSL REQUIRED )
|
|
|
|
include_directories( SYSTEM ${OPENSSL_INCLUDE_DIR} )
|
|
|
|
include_directories( SYSTEM ${CURL_INCLUDE_DIRS} )
|
|
|
|
set( OPTIONAL_LIBRARIES ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES} )
|
|
|
|
endif( )
|
|
|
|
|
2017-11-24 23:07:39 -05:00
|
|
|
if( USE_TZ_DB_IN_DOT )
|
|
|
|
add_definitions( -DINSTALL=. )
|
|
|
|
endif( )
|
|
|
|
|
2017-11-24 21:34:36 -05:00
|
|
|
set( HEADER_FOLDER "include" )
|
|
|
|
set( SOURCE_FOLDER "src" )
|
|
|
|
set( TEST_FOLDER "test" )
|
|
|
|
|
|
|
|
include_directories( ${HEADER_FOLDER} )
|
|
|
|
|
|
|
|
# This is needed so IDE's live MSVC show header files
|
|
|
|
set( HEADER_FILES
|
|
|
|
${HEADER_FOLDER}/date/chrono_io.h
|
|
|
|
${HEADER_FOLDER}/date/date.h
|
|
|
|
${HEADER_FOLDER}/date/ios.h
|
|
|
|
${HEADER_FOLDER}/date/islamic.h
|
|
|
|
${HEADER_FOLDER}/date/iso_week.h
|
|
|
|
${HEADER_FOLDER}/date/julian.h
|
|
|
|
${HEADER_FOLDER}/date/tz.h
|
|
|
|
${HEADER_FOLDER}/date/tz_private.h
|
|
|
|
)
|
|
|
|
|
|
|
|
add_library( tz SHARED ${HEADER_FILES} ${SOURCE_FOLDER}/tz.cpp )
|
|
|
|
set_property(TARGET tz PROPERTY CXX_STANDARD 14)
|
|
|
|
target_link_libraries( tz ${CMAKE_THREAD_LIBS_INIT} ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} )
|
|
|
|
|
|
|
|
install( TARGETS tz DESTINATION lib )
|
|
|
|
install( DIRECTORY ${HEADER_FOLDER}/ DESTINATION include/ )
|
2017-11-24 23:07:39 -05:00
|
|
|
|
2017-11-24 23:16:02 -05:00
|
|
|
add_custom_target( testit
|
|
|
|
COMMAND ./testit
|
2017-11-24 23:19:07 -05:00
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/${TEST_FOLDER}
|
2017-11-24 23:16:02 -05:00
|
|
|
COMMENT "Run tests"
|
|
|
|
)
|