summaryrefslogtreecommitdiffstats
path: root/Modules/Compiler
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-03-26 15:55:15 (GMT)
committerBrad King <brad.king@kitware.com>2018-03-27 11:40:54 (GMT)
commit7fe580a36253281784dda9c35798693350e24859 (patch)
treeed860d357022a6c8db6f1daead9e27e7970ec1b9 /Modules/Compiler
parent1b328e09a33e61293635c7ddb9bcff986ae8d1e7 (diff)
downloadCMake-7fe580a36253281784dda9c35798693350e24859.zip
CMake-7fe580a36253281784dda9c35798693350e24859.tar.gz
CMake-7fe580a36253281784dda9c35798693350e24859.tar.bz2
Features: Add infrastructure for C++ 20 language standard
Issue: #17849
Diffstat (limited to 'Modules/Compiler')
-rw-r--r--Modules/Compiler/CMakeCommonCompilerMacros.cmake3
-rw-r--r--Modules/Compiler/Clang-CXX.cmake2
-rw-r--r--Modules/Compiler/MSVC-CXX.cmake9
3 files changed, 14 insertions, 0 deletions
diff --git a/Modules/Compiler/CMakeCommonCompilerMacros.cmake b/Modules/Compiler/CMakeCommonCompilerMacros.cmake
index 684fd30..ad464c7 100644
--- a/Modules/Compiler/CMakeCommonCompilerMacros.cmake
+++ b/Modules/Compiler/CMakeCommonCompilerMacros.cmake
@@ -78,6 +78,9 @@ endmacro()
# Define to allow compile features to be automatically determined
macro(cmake_record_cxx_compile_features)
set(_result 0)
+ if(_result EQUAL 0 AND DEFINED CMAKE_CXX20_STANDARD_COMPILE_OPTION)
+ _record_compiler_features_cxx(20)
+ endif()
if(_result EQUAL 0 AND DEFINED CMAKE_CXX17_STANDARD_COMPILE_OPTION)
_record_compiler_features_cxx(17)
endif()
diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake
index 8a7d64a..8e8ab4f 100644
--- a/Modules/Compiler/Clang-CXX.cmake
+++ b/Modules/Compiler/Clang-CXX.cmake
@@ -49,6 +49,8 @@ else()
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "")
set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "")
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "")
+ set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "")
endif()
if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
diff --git a/Modules/Compiler/MSVC-CXX.cmake b/Modules/Compiler/MSVC-CXX.cmake
index 789fff5..6a0c5d3 100644
--- a/Modules/Compiler/MSVC-CXX.cmake
+++ b/Modules/Compiler/MSVC-CXX.cmake
@@ -29,6 +29,12 @@ if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0.24215.1 AND
# for meta-features for C++14 and above. Override the default macro
# to avoid doing unnecessary work.
macro(cmake_record_cxx_compile_features)
+ if (DEFINED CMAKE_CXX20_STANDARD_COMPILE_OPTION)
+ list(APPEND CMAKE_CXX20_COMPILE_FEATURES cxx_std_20)
+ endif()
+ # The main cmake_record_cxx_compile_features macro makes all
+ # these conditional on CMAKE_CXX##_STANDARD_COMPILE_OPTION,
+ # but we can skip the conditions because we set them above.
list(APPEND CMAKE_CXX17_COMPILE_FEATURES cxx_std_17)
list(APPEND CMAKE_CXX14_COMPILE_FEATURES cxx_std_14)
list(APPEND CMAKE_CXX98_COMPILE_FEATURES cxx_std_11) # no flag needed for 11
@@ -46,6 +52,8 @@ elseif (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0)
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "")
set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "")
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "")
+ set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "")
# There is no meaningful default for this
set(CMAKE_CXX_STANDARD_DEFAULT "")
@@ -60,6 +68,7 @@ elseif (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0)
cxx_std_11
cxx_std_14
cxx_std_17
+ cxx_std_20
)
_record_compiler_features(CXX "" CMAKE_CXX_COMPILE_FEATURES)
endmacro()