aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt12
1 files changed, 10 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2c04c73c..651f84e8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -153,11 +153,19 @@ set(EXPORT_DECL "")
# Require C++14
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
-set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} $<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CXX14_EXTENSION_COMPILE_OPTION}>")
+if(CMAKE_CXX14_EXTENSION_COMPILE_OPTION)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX14_EXTENSION_COMPILE_OPTION}")
+elseif(CMAKE_CXX14_STANDARD_COMPILE_OPTION)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX14_STANDARD_COMPILE_OPTION}")
+endif()
# Prefer C11, but support C99 and C90 too.
set(CMAKE_C_STANDARD 11)
-set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} $<$<COMPILE_LANGUAGE:C>:${CMAKE_C11_EXTENSION_COMPILE_OPTION}>")
+if(CMAKE_C11_EXTENSION_COMPILE_OPTION)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C11_EXTENSION_COMPILE_OPTION}")
+elseif(CMAKE_C11_STANDARD_COMPILE_OPTION)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C11_STANDARD_COMPILE_OPTION}")
+endif()
if(NOT WIN32)
# Check if _POSIX_C_SOURCE and _XOPEN_SOURCE needs to be set for POSIX functions