diff options
author | Brad King <brad.king@kitware.com> | 2019-04-10 12:49:11 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-04-10 12:49:21 (GMT) |
commit | 876680e94bed75e1e22a78f1e063e545ff6bce69 (patch) | |
tree | 2412b6553af1973b5e45e5dc6094d18547cc394c /Modules | |
parent | 784c35b4445ca4ecf5a6aad859bd3724cdb49ff6 (diff) | |
parent | 613ac56e508be666e2b6fcf42a6502055bf0764c (diff) | |
download | CMake-876680e94bed75e1e22a78f1e063e545ff6bce69.zip CMake-876680e94bed75e1e22a78f1e063e545ff6bce69.tar.gz CMake-876680e94bed75e1e22a78f1e063e545ff6bce69.tar.bz2 |
Merge topic 'meta-feature_only_infer_granular_support'
613ac56e50 Add a test to verify meta-feature parity with granular features
b0f46c48f6 CompileFeatures: Now able to presume full language level support
646fb1a646 CompileFeatures: memoize C++ compilers with full language level support
0d641fcfad Tests: Remove outdated portion of CompileFeatures genex test
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3176
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/Compiler/CMakeCommonCompilerMacros.cmake | 35 | ||||
-rw-r--r-- | Modules/Compiler/Cray-CXX.cmake | 3 | ||||
-rw-r--r-- | Modules/Compiler/PGI-CXX.cmake | 4 | ||||
-rw-r--r-- | Modules/Compiler/XL-CXX.cmake | 2 | ||||
-rw-r--r-- | Modules/Compiler/XLClang-CXX.cmake | 3 | ||||
-rw-r--r-- | Modules/Internal/FeatureTesting.cmake | 4 |
6 files changed, 46 insertions, 5 deletions
diff --git a/Modules/Compiler/CMakeCommonCompilerMacros.cmake b/Modules/Compiler/CMakeCommonCompilerMacros.cmake index 9c62e10..96537f8 100644 --- a/Modules/Compiler/CMakeCommonCompilerMacros.cmake +++ b/Modules/Compiler/CMakeCommonCompilerMacros.cmake @@ -94,18 +94,43 @@ endmacro() 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) + 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) endif() if(_result EQUAL 0 AND DEFINED CMAKE_CXX17_STANDARD_COMPILE_OPTION) - _record_compiler_features_cxx(17) + 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) endif() if(_result EQUAL 0 AND DEFINED CMAKE_CXX14_STANDARD_COMPILE_OPTION) - _record_compiler_features_cxx(14) + if(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT) + _has_compiler_features_cxx(14) + else() + _record_compiler_features_cxx(14) + endif() + unset(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT) endif() if(_result EQUAL 0 AND DEFINED CMAKE_CXX11_STANDARD_COMPILE_OPTION) - _record_compiler_features_cxx(11) + if(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT) + _has_compiler_features_cxx(11) + else() + _record_compiler_features_cxx(11) + endif() + unset(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT) endif() if(_result EQUAL 0 AND DEFINED CMAKE_CXX98_STANDARD_COMPILE_OPTION) - _record_compiler_features_cxx(98) + if(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT) + _has_compiler_features_cxx(98) + else() + _record_compiler_features_cxx(98) + endif() + unset(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT) endif() endmacro() diff --git a/Modules/Compiler/Cray-CXX.cmake b/Modules/Compiler/Cray-CXX.cmake index 85a3167..38c8b1e 100644 --- a/Modules/Compiler/Cray-CXX.cmake +++ b/Modules/Compiler/Cray-CXX.cmake @@ -10,13 +10,16 @@ string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -DNDEBUG") if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1) set(CMAKE_CXX98_STANDARD_COMPILE_OPTION -h conform) set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION -h gnu) + set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.4) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION -h std=c++11) set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION -h std=c++11,gnu) + set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON) endif() if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.6) set(CMAKE_CXX14_STANDARD_COMPILE_OPTION -h std=c++14) set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION -h std=c++14,gnu) + set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) endif () endif () diff --git a/Modules/Compiler/PGI-CXX.cmake b/Modules/Compiler/PGI-CXX.cmake index 35076bb..c77de36 100644 --- a/Modules/Compiler/PGI-CXX.cmake +++ b/Modules/Compiler/PGI-CXX.cmake @@ -6,15 +6,19 @@ string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -DNDEBUG") if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12.10) set(CMAKE_CXX98_STANDARD_COMPILE_OPTION -A) set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION --gnu_extensions) + set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.10) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION --c++11 -A) set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION --c++11 --gnu_extensions) + set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON) if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 15.7) set(CMAKE_CXX14_STANDARD_COMPILE_OPTION --c++14 -A) set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION --c++14 --gnu_extensions) + set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 17.1) set(CMAKE_CXX17_STANDARD_COMPILE_OPTION --c++17 -A) set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION --c++17 --gnu_extensions) + set(CMAKE_CXX17_STANDARD__HAS_FULL_SUPPORT ON) endif() endif() endif() diff --git a/Modules/Compiler/XL-CXX.cmake b/Modules/Compiler/XL-CXX.cmake index 0026b4a..ec3f1f8 100644 --- a/Modules/Compiler/XL-CXX.cmake +++ b/Modules/Compiler/XL-CXX.cmake @@ -16,6 +16,8 @@ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1) endif() set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x") set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x") + set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON) endif () __compiler_check_default_language_standard(CXX 10.1 98) diff --git a/Modules/Compiler/XLClang-CXX.cmake b/Modules/Compiler/XLClang-CXX.cmake index f535ebc..03c7c7b 100644 --- a/Modules/Compiler/XLClang-CXX.cmake +++ b/Modules/Compiler/XLClang-CXX.cmake @@ -4,13 +4,16 @@ __compiler_xlclang(CXX) if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1) set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "") set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "") + set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x") set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x") + set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON) if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.2) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11") set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11") set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y") set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y") + set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) endif () endif() diff --git a/Modules/Internal/FeatureTesting.cmake b/Modules/Internal/FeatureTesting.cmake index f7b3e96..75be473 100644 --- a/Modules/Internal/FeatureTesting.cmake +++ b/Modules/Internal/FeatureTesting.cmake @@ -99,3 +99,7 @@ macro(_has_compiler_features_c std) list(APPEND CMAKE_C${std}_COMPILE_FEATURES c_std_${std}) _has_compiler_features(C ${std} "${CMAKE_C${std}_STANDARD_COMPILE_OPTION}" CMAKE_C${std}_COMPILE_FEATURES) endmacro() +macro(_has_compiler_features_cxx std) + list(APPEND CMAKE_CXX${std}_COMPILE_FEATURES cxx_std_${std}) + _has_compiler_features(CXX ${std} "${CMAKE_CXX${std}_STANDARD_COMPILE_OPTION}" CMAKE_CXX${std}_COMPILE_FEATURES) +endmacro() |