diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 60528515..258a05af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -117,20 +117,13 @@ CHECK_TYPE_SIZE("long" SIZEOF_LONG) CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG) -CHECK_C_COMPILER_FLAG(-std=c11 HAVE_STD_C11) -IF(HAVE_STD_C11) - SET(CMAKE_C_FLAGS "-std=c11 ${CMAKE_C_FLAGS}") -ELSE() - CHECK_C_COMPILER_FLAG(-std=c99 HAVE_STD_C99) - IF(HAVE_STD_C99) - SET(CMAKE_C_FLAGS "-std=c99 ${CMAKE_C_FLAGS}") - ENDIF() -ENDIF() +# Require C++11 +SET(CMAKE_CXX_STANDARD 11) +SET(CMAKE_CXX_STANDARD_REQUIRED TRUE) + +# Prefer C11, but support C99 and C90 too. +SET(CMAKE_C_STANDARD 11) -CHECK_CXX_COMPILER_FLAG(-std=c++11 HAVE_STD_CXX11) -IF(HAVE_STD_CXX11) - SET(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}") -ENDIF() if(NOT WIN32) # Check if _POSIX_C_SOURCE and _XOPEN_SOURCE needs to be set for POSIX functions |