summaryrefslogtreecommitdiffstats
path: root/Modules/Internal
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2019-03-06 17:24:48 (GMT)
committerRobert Maynard <robert.maynard@kitware.com>2019-03-20 16:10:10 (GMT)
commit85415afbdc65baa5dbe86a61008a3a3373e74e09 (patch)
tree8b3e04d0189390bbbba6c99bad7ed0879a2dd4d8 /Modules/Internal
parent616282a5ce05d29ddad12c43e64e0764d91e817b (diff)
downloadCMake-85415afbdc65baa5dbe86a61008a3a3373e74e09.zip
CMake-85415afbdc65baa5dbe86a61008a3a3373e74e09.tar.gz
CMake-85415afbdc65baa5dbe86a61008a3a3373e74e09.tar.bz2
CompileFeatures: Don't try_compile for language levels with no features
Previously Compilers always had to run a try_compile to determine what language level each feature mapped to. Now we can skip the try_compile when a language level has no features.
Diffstat (limited to 'Modules/Internal')
-rw-r--r--Modules/Internal/FeatureTesting.cmake14
1 files changed, 12 insertions, 2 deletions
diff --git a/Modules/Internal/FeatureTesting.cmake b/Modules/Internal/FeatureTesting.cmake
index de336e7..b9c20ec 100644
--- a/Modules/Internal/FeatureTesting.cmake
+++ b/Modules/Internal/FeatureTesting.cmake
@@ -71,10 +71,20 @@ endmacro()
macro(_record_compiler_features_c std)
list(APPEND CMAKE_C${std}_COMPILE_FEATURES c_std_${std})
- _record_compiler_features(C "${CMAKE_C${std}_STANDARD_COMPILE_OPTION}" CMAKE_C${std}_COMPILE_FEATURES)
+
+ get_property(lang_level_has_features GLOBAL PROPERTY CMAKE_C${std}_KNOWN_FEATURES)
+ if(lang_level_has_features)
+ _record_compiler_features(C "${CMAKE_C${std}_STANDARD_COMPILE_OPTION}" CMAKE_C${std}_COMPILE_FEATURES)
+ endif()
+ unset(lang_level_has_features)
endmacro()
macro(_record_compiler_features_cxx std)
list(APPEND CMAKE_CXX${std}_COMPILE_FEATURES cxx_std_${std})
- _record_compiler_features(CXX "${CMAKE_CXX${std}_STANDARD_COMPILE_OPTION}" CMAKE_CXX${std}_COMPILE_FEATURES)
+
+ get_property(lang_level_has_features GLOBAL PROPERTY CMAKE_CXX${std}_KNOWN_FEATURES)
+ if(lang_level_has_features)
+ _record_compiler_features(CXX "${CMAKE_CXX${std}_STANDARD_COMPILE_OPTION}" CMAKE_CXX${std}_COMPILE_FEATURES)
+ endif()
+ unset(lang_level_has_features)
endmacro()