summaryrefslogtreecommitdiffstats
path: root/Modules/Compiler/CMakeCommonCompilerMacros.cmake
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2019-03-27 19:44:37 (GMT)
committerBrad King <brad.king@kitware.com>2019-04-09 12:44:56 (GMT)
commit646fb1a646a3b860e983f3d030dfd223c761d49f (patch)
tree50598f673d9f8e7f18e9a001cecbf6be0d74b964 /Modules/Compiler/CMakeCommonCompilerMacros.cmake
parent0d641fcfad232a6981f587a8ee077dcf08432843 (diff)
downloadCMake-646fb1a646a3b860e983f3d030dfd223c761d49f.zip
CMake-646fb1a646a3b860e983f3d030dfd223c761d49f.tar.gz
CMake-646fb1a646a3b860e983f3d030dfd223c761d49f.tar.bz2
CompileFeatures: memoize C++ compilers with full language level support
Previously compilers that had full support for a language standard level were still verified every time a new build directory was created. Now we record this information and insert the correct granular compile features instead of doing a `try_compile`.
Diffstat (limited to 'Modules/Compiler/CMakeCommonCompilerMacros.cmake')
-rw-r--r--Modules/Compiler/CMakeCommonCompilerMacros.cmake35
1 files changed, 30 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()