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 /Modules/Compiler | |
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
Diffstat (limited to 'Modules/Compiler')
-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 |
3 files changed, 18 insertions, 31 deletions
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() |