Enable testing in CMakeLists.txt

* Per instructions by @SlavSlavov in https://github.com/HowardHinnant/date/pull/278
This commit is contained in:
Howard Hinnant
2018-01-28 18:40:46 -05:00
parent 040eed838b
commit 4ada98d247

View File

@@ -4,11 +4,10 @@ project( date_prj )
find_package( Threads REQUIRED )
enable_testing( )
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_TZ_STATIC "Build a static version of library" ON )
option( ENABLE_DATE_TESTING "Enable unit tests" ON )
function( print_option 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_TZ_DB_IN_DOT )
print_option( BUILD_TZ_STATIC )
print_option( ENABLE_DATE_TESTING )
set( HEADER_FOLDER "include" )
set( SOURCE_FOLDER "src" )
@@ -100,6 +100,10 @@ install( EXPORT DateConfig DESTINATION ${DEF_INSTALL_CMAKE_DIR} )
install( TARGETS tz DESTINATION lib )
install( DIRECTORY ${HEADER_FOLDER}/ DESTINATION include/ )
if ( ENABLE_DATE_TESTING )
enable_testing( )
add_custom_target( testit COMMAND ${CMAKE_CTEST_COMMAND} )
add_dependencies( testit tz )
@@ -159,4 +163,4 @@ foreach( child ${children} )
endif( )
endif( )
endforeach( )
endif( )