summaryrefslogtreecommitdiff
path: root/Modules/Internal/FeatureTesting.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-10-26 16:11:01 -0400
committerBrad King <brad.king@kitware.com>2016-11-02 10:00:28 -0400
commitb0996a3fa223370edcdb40a1d8b66d1a3a734daf (patch)
tree9b08869843c60df30b4fec54ae9b2224c4643f5b /Modules/Internal/FeatureTesting.cmake
parent8b6cc2518a8019314af43a32702a09bff318b777 (diff)
downloadcmake-b0996a3fa223370edcdb40a1d8b66d1a3a734daf.tar.gz
Features: Add meta-features requesting awareness of a particular standard
A common use case of `target_compile_features` is simply to specify that the compiler should be run in a mode that is aware of e.g. C++11. Some projects simply specify a particular C++11-only feature to request this. Provide a first-class way to do this by naming features after the corresponding language standard. Record them as always available in the corresponding standard level so that requesting them always ensures that standard (or higher) is used.
Diffstat (limited to 'Modules/Internal/FeatureTesting.cmake')
-rw-r--r--Modules/Internal/FeatureTesting.cmake2
1 files changed, 2 insertions, 0 deletions
diff --git a/Modules/Internal/FeatureTesting.cmake b/Modules/Internal/FeatureTesting.cmake
index e94246ea11..50b8526f25 100644
--- a/Modules/Internal/FeatureTesting.cmake
+++ b/Modules/Internal/FeatureTesting.cmake
@@ -60,9 +60,11 @@ macro(_record_compiler_features lang compile_flags feature_list)
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)
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)
endmacro()