Use built-in CMake feature for requiring a specific language standard

This feature was added in CMake 3.8. Requiring specific language
features is an outdated approach that CMake stopped supporting in
favor of simply specifyin the specific language standard you want.

https://cmake.org/cmake/help/v3.10/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html
This commit is contained in:
Chris Thrasher 2024-03-12 13:19:31 -06:00 committed by Martin Hořeňovský
parent 459ac8562b
commit 1a44e6f661

View File

@ -362,29 +362,10 @@ set_target_properties(Catch2 PROPERTIES
VERSION ${PROJECT_VERSION} VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION}) SOVERSION ${PROJECT_VERSION})
# depend on bunch of C++11 and C++14 features to have C++14 enabled by default # require C++14
target_compile_features(Catch2 target_compile_features(Catch2
PUBLIC PUBLIC
cxx_alignas cxx_std_14
cxx_alignof
cxx_attributes
cxx_auto_type
cxx_constexpr
cxx_defaulted_functions
cxx_deleted_functions
cxx_final
cxx_lambdas
cxx_noexcept
cxx_override
cxx_range_for
cxx_rvalue_references
cxx_static_assert
cxx_strong_enums
cxx_trailing_return_types
cxx_unicode_literals
cxx_user_literals
cxx_variable_templates
cxx_variadic_macros
) )
configure_file( configure_file(
@ -475,26 +456,7 @@ if (CATCH_BUILD_EXAMPLES OR CATCH_BUILD_EXTRA_TESTS)
) )
target_compile_features(Catch2_buildall_interface target_compile_features(Catch2_buildall_interface
INTERFACE INTERFACE
cxx_alignas cxx_std_14
cxx_alignof
cxx_attributes
cxx_auto_type
cxx_constexpr
cxx_defaulted_functions
cxx_deleted_functions
cxx_final
cxx_lambdas
cxx_noexcept
cxx_override
cxx_range_for
cxx_rvalue_references
cxx_static_assert
cxx_strong_enums
cxx_trailing_return_types
cxx_unicode_literals
cxx_user_literals
cxx_variable_templates
cxx_variadic_macros
) )
endif() endif()