summaryrefslogtreecommitdiffstats
path: root/Modules/Internal/FeatureTesting.cmake
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2019-03-06 17:28:00 (GMT)
committerRobert Maynard <robert.maynard@kitware.com>2019-03-27 19:45:11 (GMT)
commitf92ccbc306c20554af35709faf00f402a6c34978 (patch)
tree47921cf0ad7861b50bcbc2adf2642092af94e0d3 /Modules/Internal/FeatureTesting.cmake
parent9fbad8b40be8e915f84f51842d88e97b0c949b2b (diff)
downloadCMake-f92ccbc306c20554af35709faf00f402a6c34978.zip
CMake-f92ccbc306c20554af35709faf00f402a6c34978.tar.gz
CMake-f92ccbc306c20554af35709faf00f402a6c34978.tar.bz2
CompileFeatures: memoize C compilers with full language level support
Previously compilers that had full support for a language standard level was forced to verify this 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/Internal/FeatureTesting.cmake')
-rw-r--r--Modules/Internal/FeatureTesting.cmake11
1 files changed, 11 insertions, 0 deletions
diff --git a/Modules/Internal/FeatureTesting.cmake b/Modules/Internal/FeatureTesting.cmake
index b9c20ec..f7b3e96 100644
--- a/Modules/Internal/FeatureTesting.cmake
+++ b/Modules/Internal/FeatureTesting.cmake
@@ -88,3 +88,14 @@ macro(_record_compiler_features_cxx std)
endif()
unset(lang_level_has_features)
endmacro()
+
+macro(_has_compiler_features lang level compile_flags feature_list)
+ # presume all known features are supported
+ get_property(known_features GLOBAL PROPERTY CMAKE_${lang}${level}_KNOWN_FEATURES)
+ list(APPEND ${feature_list} ${known_features})
+endmacro()
+
+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()