Created
October 21, 2021 08:29
-
-
Save tea/7e1b7bb96d696df55cbf12add62624c1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set(CMAKE_CXX_STANDARD_REQUIRED ON) | |
set(CXX_EXTENSIONS OFF) | |
if(NOT CMAKE_CXX_STANDARD) | |
if("cxx_std_20" IN_LIST CMAKE_CXX_COMPILE_FEATURES) | |
set(CMAKE_CXX_STANDARD 20) | |
message(STATUS "C++20: OK") | |
elseif("cxx_std_17" IN_LIST CMAKE_CXX_COMPILE_FEATURES) | |
set(CMAKE_CXX_STANDARD 17) | |
message(STATUS "C++17: OK") | |
elseif("cxx_std_14" IN_LIST CMAKE_CXX_COMPILE_FEATURES) | |
set(CMAKE_CXX_STANDARD 14) | |
message(STATUS "C++14: OK") | |
message(WARNING "C++14 is old, please use newer compiler.") | |
elseif("cxx_std_11" IN_LIST CMAKE_CXX_COMPILE_FEATURES) | |
set(CMAKE_CXX_STANDARD 11) | |
message(STATUS "C++11: OK") | |
message(WARNING "C++11 is old, please use newer compiler.") | |
else() | |
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 or above support. Please use a different C++ compiler.") | |
endif() | |
endif() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment