mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 13:20:47 -06:00
Merge topic 'dont_do_compiler_feature_checks_for_version_with_no_features'
85415afbdcCompileFeatures: Don't try_compile for language levels with no features616282a5ceCMake: Provide language level compile features lists Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3128
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -556,9 +556,28 @@ const char* cmState::GetGlobalProperty(const std::string& prop)
|
||||
if (prop == "CMAKE_C_KNOWN_FEATURES") {
|
||||
return &FOR_EACH_C_FEATURE(STRING_LIST_ELEMENT)[1];
|
||||
}
|
||||
if (prop == "CMAKE_C90_KNOWN_FEATURES") {
|
||||
return &FOR_EACH_C90_FEATURE(STRING_LIST_ELEMENT)[1];
|
||||
}
|
||||
if (prop == "CMAKE_C99_KNOWN_FEATURES") {
|
||||
return &FOR_EACH_C99_FEATURE(STRING_LIST_ELEMENT)[1];
|
||||
}
|
||||
if (prop == "CMAKE_C11_KNOWN_FEATURES") {
|
||||
return &FOR_EACH_C11_FEATURE(STRING_LIST_ELEMENT)[1];
|
||||
}
|
||||
if (prop == "CMAKE_CXX_KNOWN_FEATURES") {
|
||||
return &FOR_EACH_CXX_FEATURE(STRING_LIST_ELEMENT)[1];
|
||||
}
|
||||
if (prop == "CMAKE_CXX98_KNOWN_FEATURES") {
|
||||
return &FOR_EACH_CXX98_FEATURE(STRING_LIST_ELEMENT)[1];
|
||||
}
|
||||
if (prop == "CMAKE_CXX11_KNOWN_FEATURES") {
|
||||
return &FOR_EACH_CXX11_FEATURE(STRING_LIST_ELEMENT)[1];
|
||||
}
|
||||
if (prop == "CMAKE_CXX14_KNOWN_FEATURES") {
|
||||
return &FOR_EACH_CXX14_FEATURE(STRING_LIST_ELEMENT)[1];
|
||||
}
|
||||
|
||||
#undef STRING_LIST_ELEMENT
|
||||
return this->GlobalProperties.GetPropertyValue(prop);
|
||||
}
|
||||
|
||||
@@ -562,40 +562,38 @@ private:
|
||||
"not errors." \
|
||||
}
|
||||
|
||||
#define FOR_EACH_C90_FEATURE(F) F(c_function_prototypes)
|
||||
|
||||
#define FOR_EACH_C99_FEATURE(F) \
|
||||
F(c_restrict) \
|
||||
F(c_variadic_macros)
|
||||
|
||||
#define FOR_EACH_C11_FEATURE(F) F(c_static_assert)
|
||||
|
||||
#define FOR_EACH_C_FEATURE(F) \
|
||||
F(c_std_90) \
|
||||
F(c_std_99) \
|
||||
F(c_std_11) \
|
||||
F(c_function_prototypes) \
|
||||
F(c_restrict) \
|
||||
F(c_static_assert) \
|
||||
F(c_variadic_macros)
|
||||
FOR_EACH_C90_FEATURE(F) \
|
||||
FOR_EACH_C99_FEATURE(F) \
|
||||
FOR_EACH_C11_FEATURE(F)
|
||||
|
||||
#define FOR_EACH_CXX_FEATURE(F) \
|
||||
F(cxx_std_98) \
|
||||
F(cxx_std_11) \
|
||||
F(cxx_std_14) \
|
||||
F(cxx_std_17) \
|
||||
F(cxx_std_20) \
|
||||
F(cxx_aggregate_default_initializers) \
|
||||
#define FOR_EACH_CXX98_FEATURE(F) F(cxx_template_template_parameters)
|
||||
|
||||
#define FOR_EACH_CXX11_FEATURE(F) \
|
||||
F(cxx_alias_templates) \
|
||||
F(cxx_alignas) \
|
||||
F(cxx_alignof) \
|
||||
F(cxx_attributes) \
|
||||
F(cxx_attribute_deprecated) \
|
||||
F(cxx_auto_type) \
|
||||
F(cxx_binary_literals) \
|
||||
F(cxx_constexpr) \
|
||||
F(cxx_contextual_conversions) \
|
||||
F(cxx_decltype) \
|
||||
F(cxx_decltype_auto) \
|
||||
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_digit_separators) \
|
||||
F(cxx_enum_forward_declarations) \
|
||||
F(cxx_explicit_conversions) \
|
||||
F(cxx_extended_friend_declarations) \
|
||||
@@ -603,11 +601,9 @@ private:
|
||||
F(cxx_final) \
|
||||
F(cxx_func_identifier) \
|
||||
F(cxx_generalized_initializers) \
|
||||
F(cxx_generic_lambdas) \
|
||||
F(cxx_inheriting_constructors) \
|
||||
F(cxx_inline_namespaces) \
|
||||
F(cxx_lambdas) \
|
||||
F(cxx_lambda_init_captures) \
|
||||
F(cxx_local_type_template_args) \
|
||||
F(cxx_long_long_type) \
|
||||
F(cxx_noexcept) \
|
||||
@@ -617,22 +613,41 @@ private:
|
||||
F(cxx_range_for) \
|
||||
F(cxx_raw_string_literals) \
|
||||
F(cxx_reference_qualified_functions) \
|
||||
F(cxx_relaxed_constexpr) \
|
||||
F(cxx_return_type_deduction) \
|
||||
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_variable_templates) \
|
||||
F(cxx_variadic_macros) \
|
||||
F(cxx_variadic_templates)
|
||||
|
||||
#define FOR_EACH_CXX14_FEATURE(F) \
|
||||
F(cxx_aggregate_default_initializers) \
|
||||
F(cxx_attribute_deprecated) \
|
||||
F(cxx_binary_literals) \
|
||||
F(cxx_contextual_conversions) \
|
||||
F(cxx_decltype_auto) \
|
||||
F(cxx_digit_separators) \
|
||||
F(cxx_generic_lambdas) \
|
||||
F(cxx_lambda_init_captures) \
|
||||
F(cxx_relaxed_constexpr) \
|
||||
F(cxx_return_type_deduction) \
|
||||
F(cxx_variable_templates)
|
||||
|
||||
#define FOR_EACH_CXX_FEATURE(F) \
|
||||
F(cxx_std_98) \
|
||||
F(cxx_std_11) \
|
||||
F(cxx_std_14) \
|
||||
F(cxx_std_17) \
|
||||
F(cxx_std_20) \
|
||||
FOR_EACH_CXX98_FEATURE(F) \
|
||||
FOR_EACH_CXX11_FEATURE(F) \
|
||||
FOR_EACH_CXX14_FEATURE(F)
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user