From 3fdfa5d3fc1170f1cc69636765502ca14b1821ef Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 2 May 2014 10:03:24 +0200 Subject: Features: Make CMAKE_CXX_KNOWN_FEATURES a property. As a 'built-in' variable it imposes a cost on all variable lookups and it is expected to be rarely used. --- Help/manual/cmake-properties.7.rst | 1 + Help/manual/cmake-variables.7.rst | 1 - Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst | 241 +++++++++++++++++++++++++++ Help/variable/CMAKE_CXX_COMPILE_FEATURES.rst | 4 +- Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst | 241 --------------------------- Modules/Internal/FeatureTesting.cmake | 5 +- Source/cmMakefile.cxx | 54 ------ Source/cmake.cxx | 6 + Source/cmake.h | 48 ++++++ Tests/CompileFeatures/CMakeLists.txt | 3 +- 10 files changed, 304 insertions(+), 300 deletions(-) create mode 100644 Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst delete mode 100644 Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index a82522d..da21e29 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -16,6 +16,7 @@ Properties of Global Scope /prop_gbl/ALLOW_DUPLICATE_CUSTOM_TARGETS /prop_gbl/AUTOGEN_TARGETS_FOLDER /prop_gbl/AUTOMOC_TARGETS_FOLDER + /prop_gbl/CMAKE_CXX_KNOWN_FEATURES /prop_gbl/DEBUG_CONFIGURATIONS /prop_gbl/DISABLED_FEATURES /prop_gbl/ENABLED_FEATURES diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index dfdd09b..82242f5 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -258,7 +258,6 @@ Variables for Languages /variable/CMAKE_COMPILER_IS_GNULANG /variable/CMAKE_CXX_COMPILE_FEATURES - /variable/CMAKE_CXX_KNOWN_FEATURES /variable/CMAKE_CXX_STANDARD /variable/CMAKE_CXX_EXTENSIONS /variable/CMAKE_Fortran_MODDIR_DEFAULT diff --git a/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst b/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst new file mode 100644 index 0000000..b8b0fcd --- /dev/null +++ b/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst @@ -0,0 +1,241 @@ +CMAKE_CXX_KNOWN_FEATURES +------------------------ + +List of C++ features known to this version of CMake. + +The features listed in this global property may be known to be available to the +C++ compiler. If the feature is available with the C++ compiler, it will +be listed in the :variable:`CMAKE_CXX_COMPILE_FEATURES` variable. + +The features listed here may be used with the :command:`target_compile_features` +command. + +The features known to this version of CMake are: + +``cxx_alias_templates`` + Template aliases, as defined in N2258_. + + .. _N2258: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf + +``cxx_alignas`` + Alignment control ``alignas``, as defined in N2341_. + + .. _N2341: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf + +``cxx_alignof`` + Alignment control ``alignof``, as defined in N2341_. + + .. _N2341: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf + +``cxx_attributes`` + Generic attributes, as defined in N2761_. + + .. _N2761: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2761.pdf + +``cxx_auto_type`` + Automatic type deduction, as defined in N1984_. + + .. _N1984: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1984.pdf + +``cxx_constexpr`` + Constant expressions, as defined in N2235_. + + .. _N2235: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf + +``cxx_decltype_incomplete_return_types`` + Decltype on incomplete return types, as defined in N3276_. + + .. _N3276 : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3276.pdf + +``cxx_decltype`` + Decltype, as defined in N2343_. + + .. _N2343: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2343.pdf + +``cxx_default_function_template_args`` + Default template arguments for function templates, as defined in DR226_ + + .. _DR226: http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#226 + +``cxx_defaulted_functions`` + Defaulted functions, as defined in N2346_. + + .. _N2346: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2346.htm + +``cxx_defaulted_move_initializers`` + Defaulted move initializers, as defined in N3053_. + + .. _N3053: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3053.html + +``cxx_delegating_constructors`` + Delegating constructors, as defined in N1986_. + + .. _N1986: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1986.pdf + +``cxx_deleted_functions`` + Deleted functions, as defined in N2346_. + + .. _N2346: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2346.htm + +``cxx_enum_forward_declarations`` + Enum forward declarations, as defined in N2764_. + + .. _N2764: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2764.pdf + +``cxx_explicit_conversions`` + Explicit conversion operators, as defined in N2437_. + + .. _N2437: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2437.pdf + +``cxx_extended_friend_declarations`` + Extended friend declarations, as defined in N1791_. + + .. _N1791: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1791.pdf + +``cxx_extern_templates`` + Extern templates, as defined in N1987_. + + .. _N1987: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1987.htm + +``cxx_final`` + Override control ``final`` keyword, as defined in N2928_. + + .. _N2928: http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2928.htm + +``cxx_func_identifier`` + Predefined ``__func__`` identifier, as defined in N2340_. + + .. _N2340: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2340.htm + +``cxx_generalized_initializers`` + Initializer lists, as defined in N2672_. + + .. _N2672: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2672.htm + +``cxx_inheriting_constructors`` + Inheriting constructors, as defined in N2540_. + + .. _N2540: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2540.htm + +``cxx_inline_namespaces`` + Inline namespaces, as defined in N2535_. + + .. _N2535: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2535.htm + +``cxx_lambdas`` + Lambda functions, as defined in N2927_. + + .. _N2927: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2927.pdf + +``cxx_local_type_template_args`` + Local and unnamed types as template arguments, as defined in N2657_. + + .. _N2657: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2657.htm + +``cxx_long_long_type`` + ``long long`` type, as defined in N1811_. + + .. _N1811: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1811.pdf + +``cxx_noexcept`` + Exception specifications, as defined in N3050_. + + .. _N3050: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3050.html + +``cxx_nonstatic_member_init`` + Non-static data member initialization, as defined in N2756. + + .. _N2756: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2756.htm + +``cxx_nullptr`` + Null pointer, as defined in N2431_. + + .. _N2431: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf + +``cxx_override`` + Override control ``override`` keyword, as defined in N2928_. + + .. _N2928: http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2928.htm + +``cxx_range_for`` + Range-based for, as defined in N2930_. + + .. _N2930: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2930.html + +``cxx_raw_string_literals`` + Raw string literals, as defined in N2442_. + + .. _N2442: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2442.htm + +``cxx_reference_qualified_functions`` + Reference qualified functions, as defined in N2439_. + + .. _N2439: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2439.htm + +``cxx_right_angle_brackets`` + Right angle bracket parsing, as defined in N1757_. + + .. _N1757: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1757.html + +``cxx_rvalue_references`` + R-value references, as defined in N2118_. + + .. _N2118: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2118.html + +``cxx_sizeof_member`` + Size of non-static data members, as defined in N2253_. + + .. _N2253: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2253.html + +``cxx_static_assert`` + Static assert, as defined in N1720_. + + .. _N1720: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1720.html + +``cxx_strong_enums`` + Strongly typed enums, as defined in N2347_. + + .. _N2347: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf + +``cxx_thread_local`` + Thread-local variables, as defined in N2659_. + + .. _N2659: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2659.htm + +``cxx_trailing_return_types`` + Automatic function return type, as defined in N2541_. + + .. _N2541: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2541.htm + +``cxx_unicode_literals`` + Unicode string literals, as defined in N2442_. + + .. _N2442: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2442.htm + +``cxx_uniform_initialization`` + Uniform intialization, as defined in N2640_. + + .. _N2640: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2640.pdf + +``cxx_unrestricted_unions`` + Unrestricted unions, as defined in N2544_. + + .. _N2544: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2544.pdf + +``cxx_user_literals`` + User-defined literals, as defined in N2765_. + + .. _N2765: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2765.pdf + +``cxx_variadic_macros`` + Variadic macros, as defined in N1653_. + + .. _N1653: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1653.htm + +``cxx_variadic_templates`` + Variadic templates, as defined in N2242_. + + .. _N2242: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2242.pdf + +``cxx_template_template_parameters`` + Template template parameters, as defined in ``ISO/IEC 14882:1998``. diff --git a/Help/variable/CMAKE_CXX_COMPILE_FEATURES.rst b/Help/variable/CMAKE_CXX_COMPILE_FEATURES.rst index 6be0124..1102c21 100644 --- a/Help/variable/CMAKE_CXX_COMPILE_FEATURES.rst +++ b/Help/variable/CMAKE_CXX_COMPILE_FEATURES.rst @@ -4,5 +4,5 @@ CMAKE_CXX_COMPILE_FEATURES List of features known to the C++ compiler These features are known to be available for use with the C++ compiler. This -list is a subset of the features listed in the :variable:`CMAKE_CXX_KNOWN_FEATURES` -variable. +list is a subset of the features listed in the :prop_gbl:`CMAKE_CXX_KNOWN_FEATURES` +global property. diff --git a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst deleted file mode 100644 index 7533f6d..0000000 --- a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst +++ /dev/null @@ -1,241 +0,0 @@ -CMAKE_CXX_KNOWN_FEATURES ------------------------- - -List of C++ features known to this version of CMake. - -The features listed in this variable may be known to be available to the -C++ compiler. If the feature is available with the C++ compiler, it will -be listed in the :variable:`CMAKE_CXX_COMPILE_FEATURES` variable. - -The features listed here may be used with the :command:`target_compile_features` -command. - -The features known to this version of CMake are: - -``cxx_alias_templates`` - Template aliases, as defined in N2258_. - - .. _N2258: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf - -``cxx_alignas`` - Alignment control ``alignas``, as defined in N2341_. - - .. _N2341: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf - -``cxx_alignof`` - Alignment control ``alignof``, as defined in N2341_. - - .. _N2341: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf - -``cxx_attributes`` - Generic attributes, as defined in N2761_. - - .. _N2761: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2761.pdf - -``cxx_auto_type`` - Automatic type deduction, as defined in N1984_. - - .. _N1984: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1984.pdf - -``cxx_constexpr`` - Constant expressions, as defined in N2235_. - - .. _N2235: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf - -``cxx_decltype_incomplete_return_types`` - Decltype on incomplete return types, as defined in N3276_. - - .. _N3276 : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3276.pdf - -``cxx_decltype`` - Decltype, as defined in N2343_. - - .. _N2343: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2343.pdf - -``cxx_default_function_template_args`` - Default template arguments for function templates, as defined in DR226_ - - .. _DR226: http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#226 - -``cxx_defaulted_functions`` - Defaulted functions, as defined in N2346_. - - .. _N2346: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2346.htm - -``cxx_defaulted_move_initializers`` - Defaulted move initializers, as defined in N3053_. - - .. _N3053: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3053.html - -``cxx_delegating_constructors`` - Delegating constructors, as defined in N1986_. - - .. _N1986: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1986.pdf - -``cxx_deleted_functions`` - Deleted functions, as defined in N2346_. - - .. _N2346: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2346.htm - -``cxx_enum_forward_declarations`` - Enum forward declarations, as defined in N2764_. - - .. _N2764: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2764.pdf - -``cxx_explicit_conversions`` - Explicit conversion operators, as defined in N2437_. - - .. _N2437: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2437.pdf - -``cxx_extended_friend_declarations`` - Extended friend declarations, as defined in N1791_. - - .. _N1791: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1791.pdf - -``cxx_extern_templates`` - Extern templates, as defined in N1987_. - - .. _N1987: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1987.htm - -``cxx_final`` - Override control ``final`` keyword, as defined in N2928_. - - .. _N2928: http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2928.htm - -``cxx_func_identifier`` - Predefined ``__func__`` identifier, as defined in N2340_. - - .. _N2340: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2340.htm - -``cxx_generalized_initializers`` - Initializer lists, as defined in N2672_. - - .. _N2672: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2672.htm - -``cxx_inheriting_constructors`` - Inheriting constructors, as defined in N2540_. - - .. _N2540: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2540.htm - -``cxx_inline_namespaces`` - Inline namespaces, as defined in N2535_. - - .. _N2535: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2535.htm - -``cxx_lambdas`` - Lambda functions, as defined in N2927_. - - .. _N2927: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2927.pdf - -``cxx_local_type_template_args`` - Local and unnamed types as template arguments, as defined in N2657_. - - .. _N2657: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2657.htm - -``cxx_long_long_type`` - ``long long`` type, as defined in N1811_. - - .. _N1811: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1811.pdf - -``cxx_noexcept`` - Exception specifications, as defined in N3050_. - - .. _N3050: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3050.html - -``cxx_nonstatic_member_init`` - Non-static data member initialization, as defined in N2756. - - .. _N2756: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2756.htm - -``cxx_nullptr`` - Null pointer, as defined in N2431_. - - .. _N2431: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf - -``cxx_override`` - Override control ``override`` keyword, as defined in N2928_. - - .. _N2928: http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2928.htm - -``cxx_range_for`` - Range-based for, as defined in N2930_. - - .. _N2930: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2930.html - -``cxx_raw_string_literals`` - Raw string literals, as defined in N2442_. - - .. _N2442: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2442.htm - -``cxx_reference_qualified_functions`` - Reference qualified functions, as defined in N2439_. - - .. _N2439: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2439.htm - -``cxx_right_angle_brackets`` - Right angle bracket parsing, as defined in N1757_. - - .. _N1757: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1757.html - -``cxx_rvalue_references`` - R-value references, as defined in N2118_. - - .. _N2118: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2118.html - -``cxx_sizeof_member`` - Size of non-static data members, as defined in N2253_. - - .. _N2253: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2253.html - -``cxx_static_assert`` - Static assert, as defined in N1720_. - - .. _N1720: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1720.html - -``cxx_strong_enums`` - Strongly typed enums, as defined in N2347_. - - .. _N2347: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf - -``cxx_thread_local`` - Thread-local variables, as defined in N2659_. - - .. _N2659: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2659.htm - -``cxx_trailing_return_types`` - Automatic function return type, as defined in N2541_. - - .. _N2541: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2541.htm - -``cxx_unicode_literals`` - Unicode string literals, as defined in N2442_. - - .. _N2442: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2442.htm - -``cxx_uniform_initialization`` - Uniform intialization, as defined in N2640_. - - .. _N2640: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2640.pdf - -``cxx_unrestricted_unions`` - Unrestricted unions, as defined in N2544_. - - .. _N2544: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2544.pdf - -``cxx_user_literals`` - User-defined literals, as defined in N2765_. - - .. _N2765: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2765.pdf - -``cxx_variadic_macros`` - Variadic macros, as defined in N1653_. - - .. _N1653: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1653.htm - -``cxx_variadic_templates`` - Variadic templates, as defined in N2242_. - - .. _N2242: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2242.pdf - -``cxx_template_template_parameters`` - Template template parameters, as defined in ``ISO/IEC 14882:1998``. diff --git a/Modules/Internal/FeatureTesting.cmake b/Modules/Internal/FeatureTesting.cmake index 92d262c..0fff36b 100644 --- a/Modules/Internal/FeatureTesting.cmake +++ b/Modules/Internal/FeatureTesting.cmake @@ -6,7 +6,10 @@ macro(record_compiler_features lang compile_flags feature_list) file(REMOVE "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.bin") file(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}" " extern const char features[] = {\"\"\n") - foreach(feature ${CMAKE_${lang}_KNOWN_FEATURES}) + + get_property(known_features GLOBAL PROPERTY CMAKE_${lang}_KNOWN_FEATURES) + + foreach(feature ${known_features}) if (_cmake_feature_test_${feature}) if (${_cmake_feature_test_${feature}} STREQUAL 1) set(_feature_condition "\"1\" ") diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index e758720..9ad637a 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -41,54 +41,6 @@ #include // for isspace #include -#define FOR_EACH_CXX_FEATURE(F) \ - F(cxx_alias_templates) \ - F(cxx_alignas) \ - F(cxx_alignof) \ - F(cxx_attributes) \ - F(cxx_auto_type) \ - F(cxx_constexpr) \ - F(cxx_decltype) \ - F(cxx_decltype_incomplete_return_types) \ - F(cxx_default_function_template_args) \ - F(cxx_defaulted_functions) \ - F(cxx_defaulted_move_initializers) \ - F(cxx_delegating_constructors) \ - F(cxx_deleted_functions) \ - F(cxx_enum_forward_declarations) \ - F(cxx_explicit_conversions) \ - F(cxx_extended_friend_declarations) \ - F(cxx_extern_templates) \ - F(cxx_final) \ - F(cxx_func_identifier) \ - F(cxx_generalized_initializers) \ - F(cxx_inheriting_constructors) \ - F(cxx_inline_namespaces) \ - F(cxx_lambdas) \ - F(cxx_local_type_template_args) \ - F(cxx_long_long_type) \ - F(cxx_noexcept) \ - F(cxx_nonstatic_member_init) \ - F(cxx_nullptr) \ - F(cxx_override) \ - F(cxx_range_for) \ - F(cxx_raw_string_literals) \ - F(cxx_reference_qualified_functions) \ - F(cxx_right_angle_brackets) \ - F(cxx_rvalue_references) \ - F(cxx_sizeof_member) \ - F(cxx_static_assert) \ - F(cxx_strong_enums) \ - F(cxx_template_template_parameters) \ - F(cxx_thread_local) \ - F(cxx_trailing_return_types) \ - F(cxx_unicode_literals) \ - F(cxx_uniform_initialization) \ - F(cxx_unrestricted_unions) \ - F(cxx_user_literals) \ - F(cxx_variadic_macros) \ - F(cxx_variadic_templates) - class cmMakefile::Internals { public: @@ -2499,12 +2451,6 @@ const char* cmMakefile::GetDefinition(const std::string& name) const { this->Internal->VarUsageStack.top().insert(name); } - if (name == "CMAKE_CXX_KNOWN_FEATURES") - { -#define STRING_LIST_ELEMENT(F) ";" #F - return FOR_EACH_CXX_FEATURE(STRING_LIST_ELEMENT) + 1; -#undef STRING_LIST_ELEMENT - } const char* def = this->Internal->VarStack.top().Get(name); if(!def) { diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 7aada4b..3e78990 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2273,6 +2273,12 @@ const char *cmake::GetProperty(const std::string& prop, } this->SetProperty("ENABLED_LANGUAGES", lang.c_str()); } + if (prop == "CMAKE_CXX_KNOWN_FEATURES") + { +#define STRING_LIST_ELEMENT(F) ";" #F + return FOR_EACH_CXX_FEATURE(STRING_LIST_ELEMENT) + 1; +#undef STRING_LIST_ELEMENT + } return this->Properties.GetPropertyValue(prop, scope, chain); } diff --git a/Source/cmake.h b/Source/cmake.h index 76a3179..33b4f74 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -458,4 +458,52 @@ private: {"-Wno-dev", "Suppress developer warnings."},\ {"-Wdev", "Enable developer warnings."} +#define FOR_EACH_CXX_FEATURE(F) \ + F(cxx_alias_templates) \ + F(cxx_alignas) \ + F(cxx_alignof) \ + F(cxx_attributes) \ + F(cxx_auto_type) \ + F(cxx_constexpr) \ + F(cxx_decltype) \ + F(cxx_decltype_incomplete_return_types) \ + F(cxx_default_function_template_args) \ + F(cxx_defaulted_functions) \ + F(cxx_defaulted_move_initializers) \ + F(cxx_delegating_constructors) \ + F(cxx_deleted_functions) \ + F(cxx_enum_forward_declarations) \ + F(cxx_explicit_conversions) \ + F(cxx_extended_friend_declarations) \ + F(cxx_extern_templates) \ + F(cxx_final) \ + F(cxx_func_identifier) \ + F(cxx_generalized_initializers) \ + F(cxx_inheriting_constructors) \ + F(cxx_inline_namespaces) \ + F(cxx_lambdas) \ + F(cxx_local_type_template_args) \ + F(cxx_long_long_type) \ + F(cxx_noexcept) \ + F(cxx_nonstatic_member_init) \ + F(cxx_nullptr) \ + F(cxx_override) \ + F(cxx_range_for) \ + F(cxx_raw_string_literals) \ + F(cxx_reference_qualified_functions) \ + F(cxx_right_angle_brackets) \ + F(cxx_rvalue_references) \ + F(cxx_sizeof_member) \ + F(cxx_static_assert) \ + F(cxx_strong_enums) \ + F(cxx_template_template_parameters) \ + F(cxx_thread_local) \ + F(cxx_trailing_return_types) \ + F(cxx_unicode_literals) \ + F(cxx_uniform_initialization) \ + F(cxx_unrestricted_unions) \ + F(cxx_user_literals) \ + F(cxx_variadic_macros) \ + F(cxx_variadic_templates) + #endif diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index ce5004b..501138d 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -22,7 +22,8 @@ macro(run_test feature) endif() endmacro() -foreach(feature ${CMAKE_CXX_KNOWN_FEATURES}) +get_property(features GLOBAL PROPERTY CMAKE_CXX_KNOWN_FEATURES) +foreach(feature ${features}) run_test(${feature}) endforeach() -- cgit v0.12