Проверка доступности стандарта C++17
This commit is contained in:
parent
81bed8b385
commit
a0cc72077c
@ -34,6 +34,14 @@ endif()
|
||||
# Выбор стандарта по умолчанию (можно переопределить в проекте)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED YES)
|
||||
|
||||
check_cxx_compiler_flag(-std=c++17 HAVE_FLAG_STD_CXX17)
|
||||
if(HAVE_FLAG_STD_CXX17)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
check_cxx_compiler_flag(-std=gnu++17 HAVE_FLAG_STD_GNUXX17)
|
||||
if(HAVE_FLAG_STD_GNUXX17)
|
||||
set(CMAKE_CXX_EXTENSIONS YES)
|
||||
endif()
|
||||
else()
|
||||
check_cxx_compiler_flag(-std=c++14 HAVE_FLAG_STD_CXX14)
|
||||
if(HAVE_FLAG_STD_CXX14)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
@ -45,6 +53,7 @@ else()
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_EXTENSIONS YES)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Common configuration for GCC, clang and Intel.
|
||||
if(CMAKE_CXX_COMPILER_IS_CLANG OR CMAKE_CXX_COMPILER_IS_INTEL OR CMAKE_CXX_COMPILER_IS_GCC)
|
||||
|
Loading…
Reference in New Issue
Block a user