summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-12-10 11:59:50 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-12-10 12:00:17 (GMT)
commit9109475bfb9371e74c6ddbf64a66054e5aaea795 (patch)
treecca450d25b2a1c56be8348c4afca2cbc1183cd90 /Modules
parent0a2bb1871981735813a3ebcf7f6d5dfbe6727eff (diff)
parent9f3c70a333f076aca61affff189232edaba89c38 (diff)
downloadCMake-9109475bfb9371e74c6ddbf64a66054e5aaea795.zip
CMake-9109475bfb9371e74c6ddbf64a66054e5aaea795.tar.gz
CMake-9109475bfb9371e74c6ddbf64a66054e5aaea795.tar.bz2
Merge topic 'cpp23'
9f3c70a333 CUDA, CXX, OBJCXX: C++23 support with Clang 12 af7e1545c8 CUDA, CXX: Remove HAS_FULL_SUPPORT for C++17 and 20 Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5576
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeCUDACompiler.cmake.in1
-rw-r--r--Modules/CMakeCUDACompilerId.cu.in4
-rw-r--r--Modules/CMakeCXXCompiler.cmake.in1
-rw-r--r--Modules/CMakeCXXCompilerId.cpp.in4
-rw-r--r--Modules/CMakeDetermineCompileFeatures.cmake14
-rw-r--r--Modules/CMakeOBJCXXCompiler.cmake.in1
-rw-r--r--Modules/CMakeOBJCXXCompilerId.mm.in4
-rw-r--r--Modules/Compiler/CMakeCommonCompilerMacros.cmake34
-rw-r--r--Modules/Compiler/Clang.cmake14
-rw-r--r--Modules/Compiler/PGI-CXX.cmake1
10 files changed, 43 insertions, 35 deletions
diff --git a/Modules/CMakeCUDACompiler.cmake.in b/Modules/CMakeCUDACompiler.cmake.in
index d4e6e2e..56ae732 100644
--- a/Modules/CMakeCUDACompiler.cmake.in
+++ b/Modules/CMakeCUDACompiler.cmake.in
@@ -12,6 +12,7 @@ set(CMAKE_CUDA11_COMPILE_FEATURES "@CMAKE_CUDA11_COMPILE_FEATURES@")
set(CMAKE_CUDA14_COMPILE_FEATURES "@CMAKE_CUDA14_COMPILE_FEATURES@")
set(CMAKE_CUDA17_COMPILE_FEATURES "@CMAKE_CUDA17_COMPILE_FEATURES@")
set(CMAKE_CUDA20_COMPILE_FEATURES "@CMAKE_CUDA20_COMPILE_FEATURES@")
+set(CMAKE_CUDA23_COMPILE_FEATURES "@CMAKE_CUDA23_COMPILE_FEATURES@")
set(CMAKE_CUDA_PLATFORM_ID "@CMAKE_CUDA_PLATFORM_ID@")
set(CMAKE_CUDA_SIMULATE_ID "@CMAKE_CUDA_SIMULATE_ID@")
diff --git a/Modules/CMakeCUDACompilerId.cu.in b/Modules/CMakeCUDACompilerId.cu.in
index 2055de2..91039e5 100644
--- a/Modules/CMakeCUDACompilerId.cu.in
+++ b/Modules/CMakeCUDACompilerId.cu.in
@@ -17,7 +17,9 @@ char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
@CMAKE_CUDA_COMPILER_ID_ERROR_FOR_TEST@
const char* info_language_dialect_default = "INFO" ":" "dialect_default["
-#if __cplusplus > 201703L
+#if __cplusplus > 202002L
+ "23"
+#elif __cplusplus > 201703L
"20"
#elif __cplusplus >= 201703L
"17"
diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in
index a235ebb..92ae2ab 100644
--- a/Modules/CMakeCXXCompiler.cmake.in
+++ b/Modules/CMakeCXXCompiler.cmake.in
@@ -11,6 +11,7 @@ set(CMAKE_CXX11_COMPILE_FEATURES "@CMAKE_CXX11_COMPILE_FEATURES@")
set(CMAKE_CXX14_COMPILE_FEATURES "@CMAKE_CXX14_COMPILE_FEATURES@")
set(CMAKE_CXX17_COMPILE_FEATURES "@CMAKE_CXX17_COMPILE_FEATURES@")
set(CMAKE_CXX20_COMPILE_FEATURES "@CMAKE_CXX20_COMPILE_FEATURES@")
+set(CMAKE_CXX23_COMPILE_FEATURES "@CMAKE_CXX23_COMPILE_FEATURES@")
set(CMAKE_CXX_PLATFORM_ID "@CMAKE_CXX_PLATFORM_ID@")
set(CMAKE_CXX_SIMULATE_ID "@CMAKE_CXX_SIMULATE_ID@")
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index 672fff8..49d9f0a 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -44,7 +44,9 @@ char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
#endif
const char* info_language_dialect_default = "INFO" ":" "dialect_default["
-#if CXX_STD > 201703L
+#if CXX_STD > 202002L
+ "23"
+#elif CXX_STD > 201703L
"20"
#elif CXX_STD >= 201703L
"17"
diff --git a/Modules/CMakeDetermineCompileFeatures.cmake b/Modules/CMakeDetermineCompileFeatures.cmake
index b50e5f1..c03a85f 100644
--- a/Modules/CMakeDetermineCompileFeatures.cmake
+++ b/Modules/CMakeDetermineCompileFeatures.cmake
@@ -50,6 +50,7 @@ function(cmake_determine_compile_features lang)
set(CMAKE_CXX14_COMPILE_FEATURES)
set(CMAKE_CXX17_COMPILE_FEATURES)
set(CMAKE_CXX20_COMPILE_FEATURES)
+ set(CMAKE_CXX23_COMPILE_FEATURES)
include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake")
@@ -60,6 +61,9 @@ function(cmake_determine_compile_features lang)
return()
endif()
+ if (CMAKE_CXX20_COMPILE_FEATURES AND CMAKE_CXX23_COMPILE_FEATURES)
+ list(REMOVE_ITEM CMAKE_CXX23_COMPILE_FEATURES ${CMAKE_CXX20_COMPILE_FEATURES})
+ endif()
if (CMAKE_CXX17_COMPILE_FEATURES AND CMAKE_CXX20_COMPILE_FEATURES)
list(REMOVE_ITEM CMAKE_CXX20_COMPILE_FEATURES ${CMAKE_CXX17_COMPILE_FEATURES})
endif()
@@ -80,6 +84,7 @@ function(cmake_determine_compile_features lang)
${CMAKE_CXX14_COMPILE_FEATURES}
${CMAKE_CXX17_COMPILE_FEATURES}
${CMAKE_CXX20_COMPILE_FEATURES}
+ ${CMAKE_CXX23_COMPILE_FEATURES}
)
endif()
@@ -89,6 +94,7 @@ function(cmake_determine_compile_features lang)
set(CMAKE_CXX14_COMPILE_FEATURES ${CMAKE_CXX14_COMPILE_FEATURES} PARENT_SCOPE)
set(CMAKE_CXX17_COMPILE_FEATURES ${CMAKE_CXX17_COMPILE_FEATURES} PARENT_SCOPE)
set(CMAKE_CXX20_COMPILE_FEATURES ${CMAKE_CXX20_COMPILE_FEATURES} PARENT_SCOPE)
+ set(CMAKE_CXX23_COMPILE_FEATURES ${CMAKE_CXX23_COMPILE_FEATURES} PARENT_SCOPE)
message(CHECK_PASS "done")
@@ -100,6 +106,7 @@ function(cmake_determine_compile_features lang)
set(CMAKE_CUDA14_COMPILE_FEATURES)
set(CMAKE_CUDA17_COMPILE_FEATURES)
set(CMAKE_CUDA20_COMPILE_FEATURES)
+ set(CMAKE_CUDA23_COMPILE_FEATURES)
include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake")
@@ -110,7 +117,10 @@ function(cmake_determine_compile_features lang)
return()
endif()
- if (CMAKE_CUDA17_COMPILE_FEATURES AND CMAKE_CUDA20_COMPILE_FEATURES)
+ if (CMAKE_CUDA20_COMPILE_FEATURES AND CMAKE_CUDA23_COMPILE_FEATURES)
+ list(REMOVE_ITEM CMAKE_CUDA23_COMPILE_FEATURES ${CMAKE_CUDA20_COMPILE_FEATURES})
+ endif()
+ if (CMAKE_CUDA17_COMPILE_FEATURES AND CMAKE_CUDA20_COMPILE_FEATURES)
list(REMOVE_ITEM CMAKE_CUDA20_COMPILE_FEATURES ${CMAKE_CUDA17_COMPILE_FEATURES})
endif()
if (CMAKE_CUDA14_COMPILE_FEATURES AND CMAKE_CUDA17_COMPILE_FEATURES)
@@ -130,6 +140,7 @@ function(cmake_determine_compile_features lang)
${CMAKE_CUDA14_COMPILE_FEATURES}
${CMAKE_CUDA17_COMPILE_FEATURES}
${CMAKE_CUDA20_COMPILE_FEATURES}
+ ${CMAKE_CUDA23_COMPILE_FEATURES}
)
endif()
@@ -139,6 +150,7 @@ function(cmake_determine_compile_features lang)
set(CMAKE_CUDA14_COMPILE_FEATURES ${CMAKE_CUDA14_COMPILE_FEATURES} PARENT_SCOPE)
set(CMAKE_CUDA17_COMPILE_FEATURES ${CMAKE_CUDA17_COMPILE_FEATURES} PARENT_SCOPE)
set(CMAKE_CUDA20_COMPILE_FEATURES ${CMAKE_CUDA20_COMPILE_FEATURES} PARENT_SCOPE)
+ set(CMAKE_CUDA23_COMPILE_FEATURES ${CMAKE_CUDA23_COMPILE_FEATURES} PARENT_SCOPE)
message(CHECK_PASS "done")
diff --git a/Modules/CMakeOBJCXXCompiler.cmake.in b/Modules/CMakeOBJCXXCompiler.cmake.in
index 18eb7ff..a24582b 100644
--- a/Modules/CMakeOBJCXXCompiler.cmake.in
+++ b/Modules/CMakeOBJCXXCompiler.cmake.in
@@ -11,6 +11,7 @@ set(CMAKE_OBJCXX11_COMPILE_FEATURES "@CMAKE_OBJCXX11_COMPILE_FEATURES@")
set(CMAKE_OBJCXX14_COMPILE_FEATURES "@CMAKE_OBJCXX14_COMPILE_FEATURES@")
set(CMAKE_OBJCXX17_COMPILE_FEATURES "@CMAKE_OBJCXX17_COMPILE_FEATURES@")
set(CMAKE_OBJCXX20_COMPILE_FEATURES "@CMAKE_OBJCXX20_COMPILE_FEATURES@")
+set(CMAKE_OBJCXX23_COMPILE_FEATURES "@CMAKE_OBJCXX23_COMPILE_FEATURES@")
set(CMAKE_OBJCXX_PLATFORM_ID "@CMAKE_OBJCXX_PLATFORM_ID@")
set(CMAKE_OBJCXX_SIMULATE_ID "@CMAKE_OBJCXX_SIMULATE_ID@")
diff --git a/Modules/CMakeOBJCXXCompilerId.mm.in b/Modules/CMakeOBJCXXCompilerId.mm.in
index fe04de1..e2ac35d 100644
--- a/Modules/CMakeOBJCXXCompilerId.mm.in
+++ b/Modules/CMakeOBJCXXCompilerId.mm.in
@@ -30,7 +30,9 @@ char const* qnxnto = "INFO" ":" "qnxnto[]";
#endif
const char* info_language_dialect_default = "INFO" ":" "dialect_default["
-#if CXX_STD > 201703L
+#if CXX_STD > 202002L
+ "23"
+#elfif CXX_STD > 201703L
"20"
#elif CXX_STD >= 201703L
"17"
diff --git a/Modules/Compiler/CMakeCommonCompilerMacros.cmake b/Modules/Compiler/CMakeCommonCompilerMacros.cmake
index 409b65a..cd897c5 100644
--- a/Modules/Compiler/CMakeCommonCompilerMacros.cmake
+++ b/Modules/Compiler/CMakeCommonCompilerMacros.cmake
@@ -93,21 +93,14 @@ 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_CXX23_STANDARD_COMPILE_OPTION)
+ _has_compiler_features_cxx(23)
+ endif()
if(_result EQUAL 0 AND DEFINED CMAKE_CXX20_STANDARD_COMPILE_OPTION)
- if(CMAKE_CXX20_STANDARD__HAS_FULL_SUPPORT)
- _has_compiler_features_cxx(20)
- else()
- _record_compiler_features_cxx(20)
- endif()
- unset(CMAKE_CXX20_STANDARD__HAS_FULL_SUPPORT)
+ _has_compiler_features_cxx(20)
endif()
if(_result EQUAL 0 AND DEFINED CMAKE_CXX17_STANDARD_COMPILE_OPTION)
- if(CMAKE_CXX17_STANDARD__HAS_FULL_SUPPORT)
- _has_compiler_features_cxx(17)
- else()
- _record_compiler_features_cxx(17)
- endif()
- unset(CMAKE_CXX17_STANDARD__HAS_FULL_SUPPORT)
+ _has_compiler_features_cxx(17)
endif()
if(_result EQUAL 0 AND DEFINED CMAKE_CXX14_STANDARD_COMPILE_OPTION)
if(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT)
@@ -137,21 +130,14 @@ endmacro()
macro(cmake_record_cuda_compile_features)
set(_result 0)
+ if(_result EQUAL 0 AND DEFINED CMAKE_CUDA23_STANDARD_COMPILE_OPTION)
+ _has_compiler_features_cuda(23)
+ endif()
if(_result EQUAL 0 AND DEFINED CMAKE_CUDA20_STANDARD_COMPILE_OPTION)
- if(CMAKE_CUDA20_STANDARD__HAS_FULL_SUPPORT)
- _has_compiler_features_cuda(20)
- else()
- _record_compiler_features_cuda(20)
- endif()
- unset(CMAKE_CUDA20_STANDARD__HAS_FULL_SUPPORT)
+ _has_compiler_features_cuda(20)
endif()
if(_result EQUAL 0 AND DEFINED CMAKE_CUDA17_STANDARD_COMPILE_OPTION)
- if(CMAKE_CUDA17_STANDARD__HAS_FULL_SUPPORT)
- _has_compiler_features_cuda(17)
- else()
- _record_compiler_features_cuda(17)
- endif()
- unset(CMAKE_CUDA17_STANDARD__HAS_FULL_SUPPORT)
+ _has_compiler_features_cuda(17)
endif()
if(_result EQUAL 0 AND DEFINED CMAKE_CUDA14_STANDARD_COMPILE_OPTION)
if(CMAKE_CUDA14_STANDARD__HAS_FULL_SUPPORT)
diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake
index 27692c2..9f900df 100644
--- a/Modules/Compiler/Clang.cmake
+++ b/Modules/Compiler/Clang.cmake
@@ -155,10 +155,6 @@ macro(__compiler_clang_cxx_standards lang)
set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
endif()
- if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 6.0)
- set(CMAKE_${lang}17_STANDARD__HAS_FULL_SUPPORT ON)
- endif()
-
if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 11.0)
set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std=c++20")
set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std=gnu++20")
@@ -169,6 +165,11 @@ macro(__compiler_clang_cxx_standards lang)
unset(_clang_version_std17)
+ if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 12.0)
+ set(CMAKE_${lang}23_STANDARD_COMPILE_OPTION "-std=c++2b")
+ set(CMAKE_${lang}23_EXTENSION_COMPILE_OPTION "-std=gnu++2b")
+ endif()
+
if("x${CMAKE_${lang}_SIMULATE_ID}" STREQUAL "xMSVC")
# The MSVC standard library requires C++14, and MSVC itself has no
# notion of operating in a mode not aware of at least that standard.
@@ -180,8 +181,6 @@ macro(__compiler_clang_cxx_standards lang)
# This clang++ is missing some features because of MSVC compatibility.
unset(CMAKE_${lang}11_STANDARD__HAS_FULL_SUPPORT)
unset(CMAKE_${lang}14_STANDARD__HAS_FULL_SUPPORT)
- unset(CMAKE_${lang}17_STANDARD__HAS_FULL_SUPPORT)
- unset(CMAKE_${lang}20_STANDARD__HAS_FULL_SUPPORT)
endif()
__compiler_check_default_language_standard(${lang} 2.1 98)
@@ -221,6 +220,8 @@ macro(__compiler_clang_cxx_standards lang)
set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "")
set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "")
set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "")
+ set(CMAKE_${lang}23_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_${lang}23_EXTENSION_COMPILE_OPTION "")
# There is no meaningful default for this
set(CMAKE_${lang}_STANDARD_DEFAULT "")
@@ -236,6 +237,7 @@ macro(__compiler_clang_cxx_standards lang)
cxx_std_14
cxx_std_17
cxx_std_20
+ cxx_std_23
)
_record_compiler_features(${lang} "" CMAKE_${lang}_COMPILE_FEATURES)
endmacro()
diff --git a/Modules/Compiler/PGI-CXX.cmake b/Modules/Compiler/PGI-CXX.cmake
index 2d7a303..3254353 100644
--- a/Modules/Compiler/PGI-CXX.cmake
+++ b/Modules/Compiler/PGI-CXX.cmake
@@ -18,7 +18,6 @@ if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12.10)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 17.1)
set(CMAKE_CXX17_STANDARD_COMPILE_OPTION --c++17)
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION --c++17 --gnu_extensions)
- set(CMAKE_CXX17_STANDARD__HAS_FULL_SUPPORT ON)
endif()
endif()
endif()