From 1dcc6361fe5c06dfd3ec30cfb9bce04e0c522805 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 22 Jan 2021 08:42:02 -0800 Subject: Fix setting the correct standards flag --- CMakeLists.txt | 12 ++++++++++-- 1 file 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} $<$:${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} $<$:${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 -- cgit v1.2.3