From e73902352948c3e04a6ce680c23a2762b74222cb Mon Sep 17 00:00:00 2001 From: o9000 Date: Wed, 20 Dec 2017 19:59:35 +0100 Subject: [PATCH] Set C standard version depending on feature tests --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 46dd7b9..9d660c1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,6 +68,9 @@ check_c_source_compiles( if(HAS_GENERIC) add_definitions(-DHAS_GENERIC) + set(CSTD "c11") +else() + set(CSTD "c99") endif(HAS_GENERIC) if( ENABLE_RSVG ) @@ -277,7 +280,7 @@ endif( RT_LIBRARY ) target_link_libraries( tint2 m ) add_dependencies( tint2 version ) -set_target_properties( tint2 PROPERTIES COMPILE_FLAGS "-Wall -Wpointer-arith -fno-strict-aliasing -pthread -std=c11 ${ASAN_C_FLAGS} ${TRACING_C_FLAGS}" ) +set_target_properties( tint2 PROPERTIES COMPILE_FLAGS "-Wall -Wpointer-arith -fno-strict-aliasing -pthread -std=${CSTD} ${ASAN_C_FLAGS} ${TRACING_C_FLAGS}" ) set_target_properties( tint2 PROPERTIES LINK_FLAGS "-pthread -fno-strict-aliasing ${ASAN_L_FLAGS} ${BACKTRACE_L_FLAGS} ${TRACING_L_FLAGS}" ) install( TARGETS tint2 DESTINATION bin )