Use the highest possible C++ standard (#18)

This commit is contained in:
Roey Darwish Dror 2017-12-25 17:14:50 +02:00
parent 0af7654764
commit 44c2515280

View File

@ -52,7 +52,14 @@ if( BUILD_STATIC )
else( )
add_library( tz SHARED ${HEADER_FILES} ${SOURCE_FOLDER}/tz.cpp )
endif( )
set_property(TARGET tz PROPERTY CXX_STANDARD 14)
if ( ${CMAKE_MINOR_VERSION} GREATER 7 )
set( TZ_CXX_STANDARD 17 )
else( )
set( TZ_CXX_STANDARD 14 )
endif( )
set_property(TARGET tz PROPERTY CXX_STANDARD ${TZ_CXX_STANDARD})
target_link_libraries( tz ${CMAKE_THREAD_LIBS_INIT} ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} )
# add include folders to the library and targets that consume it
@ -83,7 +90,7 @@ function( add_pass_tests TEST_GLOB TEST_PREFIX )
set( BIN_NAME ${PREFIX}_bin )
set( TST_NAME ${PREFIX}_test )
add_executable( ${BIN_NAME} EXCLUDE_FROM_ALL ${TEST_FILE} )
set_property(TARGET ${BIN_NAME} PROPERTY CXX_STANDARD 14)
set_property(TARGET ${BIN_NAME} PROPERTY CXX_STANDARD ${TZ_CXX_STANDARD})
add_test( ${TST_NAME} ${BIN_NAME} )
target_link_libraries( ${BIN_NAME} tz )
add_dependencies( testit ${BIN_NAME} )