forked from HowardHinnant/date
Enable testing in CMakeLists.txt
* Per instructions by @SlavSlavov in https://github.com/HowardHinnant/date/pull/278
This commit is contained in:
@@ -4,11 +4,10 @@ project( date_prj )
|
|||||||
|
|
||||||
find_package( Threads REQUIRED )
|
find_package( Threads REQUIRED )
|
||||||
|
|
||||||
enable_testing( )
|
|
||||||
|
|
||||||
option( USE_SYSTEM_TZ_DB "Use the operating system's timezone database" OFF )
|
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( USE_TZ_DB_IN_DOT "Save the timezone database in the current folder" OFF )
|
||||||
option( BUILD_TZ_STATIC "Build a static version of library" ON )
|
option( BUILD_TZ_STATIC "Build a static version of library" ON )
|
||||||
|
option( ENABLE_DATE_TESTING "Enable unit tests" ON )
|
||||||
|
|
||||||
function( print_option OPT )
|
function( print_option OPT )
|
||||||
if ( NOT DEFINED PRINT_OPTION_CURR_${OPT} OR ( NOT PRINT_OPTION_CURR_${OPT} STREQUAL ${OPT} ) )
|
if ( NOT DEFINED PRINT_OPTION_CURR_${OPT} OR ( NOT PRINT_OPTION_CURR_${OPT} STREQUAL ${OPT} ) )
|
||||||
@@ -21,6 +20,7 @@ endfunction( )
|
|||||||
print_option( USE_SYSTEM_TZ_DB )
|
print_option( USE_SYSTEM_TZ_DB )
|
||||||
print_option( USE_TZ_DB_IN_DOT )
|
print_option( USE_TZ_DB_IN_DOT )
|
||||||
print_option( BUILD_TZ_STATIC )
|
print_option( BUILD_TZ_STATIC )
|
||||||
|
print_option( ENABLE_DATE_TESTING )
|
||||||
|
|
||||||
set( HEADER_FOLDER "include" )
|
set( HEADER_FOLDER "include" )
|
||||||
set( SOURCE_FOLDER "src" )
|
set( SOURCE_FOLDER "src" )
|
||||||
@@ -100,6 +100,10 @@ install( EXPORT DateConfig DESTINATION ${DEF_INSTALL_CMAKE_DIR} )
|
|||||||
install( TARGETS tz DESTINATION lib )
|
install( TARGETS tz DESTINATION lib )
|
||||||
install( DIRECTORY ${HEADER_FOLDER}/ DESTINATION include/ )
|
install( DIRECTORY ${HEADER_FOLDER}/ DESTINATION include/ )
|
||||||
|
|
||||||
|
if ( ENABLE_DATE_TESTING )
|
||||||
|
|
||||||
|
enable_testing( )
|
||||||
|
|
||||||
add_custom_target( testit COMMAND ${CMAKE_CTEST_COMMAND} )
|
add_custom_target( testit COMMAND ${CMAKE_CTEST_COMMAND} )
|
||||||
|
|
||||||
add_dependencies( testit tz )
|
add_dependencies( testit tz )
|
||||||
@@ -159,4 +163,4 @@ foreach( child ${children} )
|
|||||||
endif( )
|
endif( )
|
||||||
endif( )
|
endif( )
|
||||||
endforeach( )
|
endforeach( )
|
||||||
|
endif( )
|
||||||
|
Reference in New Issue
Block a user