diff options
author | Brad King <brad.king@kitware.com> | 2020-12-10 11:59:50 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-12-10 12:00:17 (GMT) |
commit | 9109475bfb9371e74c6ddbf64a66054e5aaea795 (patch) | |
tree | cca450d25b2a1c56be8348c4afca2cbc1183cd90 | |
parent | 0a2bb1871981735813a3ebcf7f6d5dfbe6727eff (diff) | |
parent | 9f3c70a333f076aca61affff189232edaba89c38 (diff) | |
download | CMake-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
-rw-r--r-- | Help/prop_gbl/CMAKE_CUDA_KNOWN_FEATURES.rst | 3 | ||||
-rw-r--r-- | Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst | 2 | ||||
-rw-r--r-- | Help/prop_tgt/CUDA_STANDARD.rst | 2 | ||||
-rw-r--r-- | Help/prop_tgt/CXX_STANDARD.rst | 2 | ||||
-rw-r--r-- | Help/prop_tgt/OBJCXX_STANDARD.rst | 2 | ||||
-rw-r--r-- | Help/release/dev/cpp-cuda-23.rst | 7 | ||||
-rw-r--r-- | Modules/CMakeCUDACompiler.cmake.in | 1 | ||||
-rw-r--r-- | Modules/CMakeCUDACompilerId.cu.in | 4 | ||||
-rw-r--r-- | Modules/CMakeCXXCompiler.cmake.in | 1 | ||||
-rw-r--r-- | Modules/CMakeCXXCompilerId.cpp.in | 4 | ||||
-rw-r--r-- | Modules/CMakeDetermineCompileFeatures.cmake | 14 | ||||
-rw-r--r-- | Modules/CMakeOBJCXXCompiler.cmake.in | 1 | ||||
-rw-r--r-- | Modules/CMakeOBJCXXCompilerId.mm.in | 4 | ||||
-rw-r--r-- | Modules/Compiler/CMakeCommonCompilerMacros.cmake | 34 | ||||
-rw-r--r-- | Modules/Compiler/Clang.cmake | 14 | ||||
-rw-r--r-- | Modules/Compiler/PGI-CXX.cmake | 1 | ||||
-rw-r--r-- | Source/cmStandardLevelResolver.cxx | 12 | ||||
-rw-r--r-- | Source/cmake.h | 4 | ||||
-rw-r--r-- | Tests/CompileFeatures/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/CompileFeatures/default_dialect.cpp | 6 | ||||
-rw-r--r-- | Tests/CompileFeatures/genex_test.cpp | 6 |
21 files changed, 80 insertions, 46 deletions
diff --git a/Help/prop_gbl/CMAKE_CUDA_KNOWN_FEATURES.rst b/Help/prop_gbl/CMAKE_CUDA_KNOWN_FEATURES.rst index e8e3148..6bbb870 100644 --- a/Help/prop_gbl/CMAKE_CUDA_KNOWN_FEATURES.rst +++ b/Help/prop_gbl/CMAKE_CUDA_KNOWN_FEATURES.rst @@ -30,3 +30,6 @@ The features known to this version of CMake are: ``cuda_std_20`` Compiler mode is at least CUDA/C++ 20. + +``cuda_std_23`` + Compiler mode is at least CUDA/C++ 23. diff --git a/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst b/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst index bac3274..73c0b34 100644 --- a/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst +++ b/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst @@ -37,6 +37,8 @@ but it does not necessarily imply complete conformance to that standard. ``cxx_std_20`` Compiler mode is at least C++ 20. +``cxx_std_23`` + Compiler mode is at least C++ 23. Low level individual compile features ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Help/prop_tgt/CUDA_STANDARD.rst b/Help/prop_tgt/CUDA_STANDARD.rst index fcc4725..6517035 100644 --- a/Help/prop_tgt/CUDA_STANDARD.rst +++ b/Help/prop_tgt/CUDA_STANDARD.rst @@ -9,7 +9,7 @@ This property specifies the CUDA/C++ standard whose features are requested to build this target. For some compilers, this results in adding a flag such as ``-std=gnu++11`` to the compile line. -Supported values are ``98``, ``03``, ``11``, ``14``, ``17``, ``20``. +Supported values are ``98``, ``03``, ``11``, ``14``, ``17``, ``20``, ``23``. If the value requested does not result in a compile flag being added for the compiler in use, a previous standard flag will be added instead. This diff --git a/Help/prop_tgt/CXX_STANDARD.rst b/Help/prop_tgt/CXX_STANDARD.rst index f322ffe..be0dab5 100644 --- a/Help/prop_tgt/CXX_STANDARD.rst +++ b/Help/prop_tgt/CXX_STANDARD.rst @@ -11,7 +11,7 @@ flag such as ``-std=gnu++11`` to the compile line. For compilers that have no notion of a standard level, such as Microsoft Visual C++ before 2015 Update 3, this has no effect. -Supported values are ``98``, ``11``, ``14``, ``17``, and ``20``. +Supported values are ``98``, ``11``, ``14``, ``17``, ``20``, ``23``. If the value requested does not result in a compile flag being added for the compiler in use, a previous standard flag will be added instead. This diff --git a/Help/prop_tgt/OBJCXX_STANDARD.rst b/Help/prop_tgt/OBJCXX_STANDARD.rst index 1067153..96088af 100644 --- a/Help/prop_tgt/OBJCXX_STANDARD.rst +++ b/Help/prop_tgt/OBJCXX_STANDARD.rst @@ -9,7 +9,7 @@ This property specifies the ObjC++ standard whose features are requested to build this target. For some compilers, this results in adding a flag such as ``-std=gnu++11`` to the compile line. -Supported values are ``98``, ``11``, ``14``, ``17``, and ``20``. +Supported values are ``98``, ``11``, ``14``, ``17``, ``20``, ``23``. If the value requested does not result in a compile flag being added for the compiler in use, a previous standard flag will be added instead. This diff --git a/Help/release/dev/cpp-cuda-23.rst b/Help/release/dev/cpp-cuda-23.rst new file mode 100644 index 0000000..dc7c3b1 --- /dev/null +++ b/Help/release/dev/cpp-cuda-23.rst @@ -0,0 +1,7 @@ +cpp-cuda-23 +----------- + +* :prop_tgt:`CXX_STANDARD`, :prop_tgt:`CUDA_STANDARD`, + :prop_tgt:`OBJCXX_STANDARD` and the + :manual:`Compile Features <cmake-compile-features(7)>` functionality gained + support for C++23. 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() diff --git a/Source/cmStandardLevelResolver.cxx b/Source/cmStandardLevelResolver.cxx index 8672f61..5d8ccf1 100644 --- a/Source/cmStandardLevelResolver.cxx +++ b/Source/cmStandardLevelResolver.cxx @@ -311,19 +311,19 @@ std::unordered_map<std::string, StanardLevelComputer> StandardComputerMapping = std::vector<std::string>{ "90", "99", "11" } } }, { "CXX", StanardLevelComputer{ - "CXX", std::vector<int>{ 98, 11, 14, 17, 20 }, - std::vector<std::string>{ "98", "11", "14", "17", "20" } } }, + "CXX", std::vector<int>{ 98, 11, 14, 17, 20, 23 }, + std::vector<std::string>{ "98", "11", "14", "17", "20", "23" } } }, { "CUDA", StanardLevelComputer{ - "CUDA", std::vector<int>{ 03, 11, 14, 17, 20 }, - std::vector<std::string>{ "03", "11", "14", "17", "20" } } }, + "CUDA", std::vector<int>{ 03, 11, 14, 17, 20, 23 }, + std::vector<std::string>{ "03", "11", "14", "17", "20", "23" } } }, { "OBJC", StanardLevelComputer{ "OBJC", std::vector<int>{ 90, 99, 11 }, std::vector<std::string>{ "90", "99", "11" } } }, { "OBJCXX", StanardLevelComputer{ - "OBJCXX", std::vector<int>{ 98, 11, 14, 17, 20 }, - std::vector<std::string>{ "98", "11", "14", "17", "20" } } }, + "OBJCXX", std::vector<int>{ 98, 11, 14, 17, 20, 23 }, + std::vector<std::string>{ "98", "11", "14", "17", "20", "23" } } }, }; } diff --git a/Source/cmake.h b/Source/cmake.h index 914b827..d936f28 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -811,6 +811,7 @@ private: F(cxx_std_14) \ F(cxx_std_17) \ F(cxx_std_20) \ + F(cxx_std_23) \ FOR_EACH_CXX98_FEATURE(F) \ FOR_EACH_CXX11_FEATURE(F) \ FOR_EACH_CXX14_FEATURE(F) @@ -820,4 +821,5 @@ private: F(cuda_std_11) \ F(cuda_std_14) \ F(cuda_std_17) \ - F(cuda_std_20) + F(cuda_std_20) \ + F(cuda_std_23) diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index ef9198d..0838532 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -268,6 +268,7 @@ if (CMAKE_CXX_COMPILE_FEATURES) if (std_flag_idx EQUAL -1) add_executable(default_dialect default_dialect.cpp) target_compile_definitions(default_dialect PRIVATE + DEFAULT_CXX23=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},23> DEFAULT_CXX20=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},20> DEFAULT_CXX17=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},17> DEFAULT_CXX14=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},14> @@ -349,6 +350,7 @@ else() HAVE_CXX_STD_14=$<COMPILE_FEATURES:cxx_std_14> HAVE_CXX_STD_17=$<COMPILE_FEATURES:cxx_std_17> HAVE_CXX_STD_20=$<COMPILE_FEATURES:cxx_std_20> + HAVE_CXX_STD_23=$<COMPILE_FEATURES:cxx_std_23> ) endif() diff --git a/Tests/CompileFeatures/default_dialect.cpp b/Tests/CompileFeatures/default_dialect.cpp index e6b3ff6..bd504ff 100644 --- a/Tests/CompileFeatures/default_dialect.cpp +++ b/Tests/CompileFeatures/default_dialect.cpp @@ -18,7 +18,11 @@ struct Outputter; # define CXX_STD __cplusplus #endif -#if DEFAULT_CXX20 +#if DEFAULT_CXX23 +# if CXX_STD <= 202002L +Outputter<CXX_STD> o; +# endif +#elif DEFAULT_CXX20 # if CXX_STD <= 201703L Outputter<CXX_STD> o; # endif diff --git a/Tests/CompileFeatures/genex_test.cpp b/Tests/CompileFeatures/genex_test.cpp index 53dce62..9c3910e 100644 --- a/Tests/CompileFeatures/genex_test.cpp +++ b/Tests/CompileFeatures/genex_test.cpp @@ -21,6 +21,12 @@ # if HAVE_CXX_STD_17 && !defined(ALLOW_LATER_STANDARDS) # error HAVE_CXX_STD_17 is true with CXX_STANDARD == 11 # endif +# if HAVE_CXX_STD_20 && !defined(ALLOW_LATER_STANDARDS) +# error HAVE_CXX_STD_20 is true with CXX_STANDARD == 11 +# endif +# if HAVE_CXX_STD_23 && !defined(ALLOW_LATER_STANDARDS) +# error HAVE_CXX_STD_23 is true with CXX_STANDARD == 11 +# endif #endif #if !HAVE_OVERRIDE_CONTROL |