Features: Split the Clang testable features to a separate file.

These tests can be shared with the AppleClang compile feature tests.
This commit is contained in:
Stephen Kelly 2014-11-11 22:59:16 +01:00
parent f476b41fd8
commit e68d5c6000
2 changed files with 55 additions and 53 deletions

View File

@ -2,61 +2,9 @@
# Reference: http://clang.llvm.org/cxx_status.html # Reference: http://clang.llvm.org/cxx_status.html
# http://clang.llvm.org/docs/LanguageExtensions.html # http://clang.llvm.org/docs/LanguageExtensions.html
set(testable_features
cxx_alias_templates
cxx_alignas
cxx_attributes
cxx_auto_type
cxx_binary_literals
cxx_constexpr
cxx_contextual_conversions
cxx_decltype
cxx_decltype_incomplete_return_types
cxx_default_function_template_args
cxx_defaulted_functions
cxx_delegating_constructors
cxx_deleted_functions
cxx_explicit_conversions
cxx_generalized_initializers
cxx_inheriting_constructors
cxx_lambdas
cxx_local_type_template_args
cxx_noexcept
cxx_nonstatic_member_init
cxx_nullptr
cxx_range_for
cxx_raw_string_literals
cxx_reference_qualified_functions
cxx_relaxed_constexpr
cxx_return_type_deduction
cxx_rvalue_references
cxx_static_assert
cxx_strong_enums
cxx_thread_local
cxx_unicode_literals
cxx_unrestricted_unions
cxx_user_literals
cxx_variable_templates
cxx_variadic_templates
)
set(_cmake_oldestSupported "((__clang_major__ * 100) + __clang_minor__) >= 304") set(_cmake_oldestSupported "((__clang_major__ * 100) + __clang_minor__) >= 304")
foreach(feature ${testable_features}) include("${CMAKE_CURRENT_LIST_DIR}/Clang-CXX-TestableFeatures.cmake")
set(_cmake_feature_test_${feature} "${_cmake_oldestSupported} && __has_feature(${feature})")
endforeach()
unset(testable_features)
set(_cmake_feature_test_cxx_aggregate_default_initializers "${_cmake_oldestSupported} && __has_feature(cxx_aggregate_nsdmi)")
set(_cmake_feature_test_cxx_trailing_return_types "${_cmake_oldestSupported} && __has_feature(cxx_trailing_return)")
set(_cmake_feature_test_cxx_alignof "${_cmake_oldestSupported} && __has_feature(cxx_alignas)")
set(_cmake_feature_test_cxx_final "${_cmake_oldestSupported} && __has_feature(cxx_override_control)")
set(_cmake_feature_test_cxx_override "${_cmake_oldestSupported} && __has_feature(cxx_override_control)")
set(_cmake_feature_test_cxx_uniform_initialization "${_cmake_oldestSupported} && __has_feature(cxx_generalized_initializers)")
set(_cmake_feature_test_cxx_defaulted_move_initializers "${_cmake_oldestSupported} && __has_feature(cxx_defaulted_functions)")
set(_cmake_feature_test_cxx_lambda_init_captures "${_cmake_oldestSupported} && __has_feature(cxx_init_captures)")
set(Clang34_CXX14 "((__clang_major__ * 100) + __clang_minor__) >= 304 && __cplusplus > 201103L") set(Clang34_CXX14 "((__clang_major__ * 100) + __clang_minor__) >= 304 && __cplusplus > 201103L")
# http://llvm.org/bugs/show_bug.cgi?id=19242 # http://llvm.org/bugs/show_bug.cgi?id=19242

View File

@ -0,0 +1,54 @@
set(testable_features
cxx_alias_templates
cxx_alignas
cxx_attributes
cxx_auto_type
cxx_binary_literals
cxx_constexpr
cxx_contextual_conversions
cxx_decltype
cxx_decltype_incomplete_return_types
cxx_default_function_template_args
cxx_defaulted_functions
cxx_delegating_constructors
cxx_deleted_functions
cxx_explicit_conversions
cxx_generalized_initializers
cxx_inheriting_constructors
cxx_lambdas
cxx_local_type_template_args
cxx_noexcept
cxx_nonstatic_member_init
cxx_nullptr
cxx_range_for
cxx_raw_string_literals
cxx_reference_qualified_functions
cxx_relaxed_constexpr
cxx_return_type_deduction
cxx_rvalue_references
cxx_static_assert
cxx_strong_enums
cxx_thread_local
cxx_unicode_literals
cxx_unrestricted_unions
cxx_user_literals
cxx_variable_templates
cxx_variadic_templates
)
foreach(feature ${testable_features})
set(_cmake_feature_test_${feature} "${_cmake_oldestSupported} && __has_feature(${feature})")
endforeach()
unset(testable_features)
set(_cmake_feature_test_cxx_aggregate_default_initializers "${_cmake_oldestSupported} && __has_feature(cxx_aggregate_nsdmi)")
set(_cmake_feature_test_cxx_trailing_return_types "${_cmake_oldestSupported} && __has_feature(cxx_trailing_return)")
set(_cmake_feature_test_cxx_alignof "${_cmake_oldestSupported} && __has_feature(cxx_alignas)")
set(_cmake_feature_test_cxx_final "${_cmake_oldestSupported} && __has_feature(cxx_override_control)")
set(_cmake_feature_test_cxx_override "${_cmake_oldestSupported} && __has_feature(cxx_override_control)")
set(_cmake_feature_test_cxx_uniform_initialization "${_cmake_oldestSupported} && __has_feature(cxx_generalized_initializers)")
set(_cmake_feature_test_cxx_defaulted_move_initializers "${_cmake_oldestSupported} && __has_feature(cxx_defaulted_functions)")
set(_cmake_feature_test_cxx_lambda_init_captures "${_cmake_oldestSupported} && __has_feature(cxx_init_captures)")