From 5c2de4a4efc33cb1da9fafd7cdc237837b97071d Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Wed, 29 Mar 2023 22:25:31 -0500 Subject: [PATCH] CMake: export C++ standard as COMPILE_FEATURE target property --- source/CMakeLists.txt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index ca59fe2abe..e73819c424 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -99,6 +99,16 @@ foreach(build ${DEAL_II_BUILD_TYPES}) # populate_target_properties(${DEAL_II_NAMESPACE}_${build_lowercase} ${build}) + # + # Record the expected C++ standard as a compile feature. This target + # property ensures that support for our expected C++ standard is always + # enabled in client user code irrespective of what compile flags/options + # they have set. + # + target_compile_features(${DEAL_II_NAMESPACE}_${build_lowercase} + INTERFACE cxx_std_${CMAKE_CXX_STANDARD} + ) + if(BUILD_SHARED_LIBS) # # Add all object targets as private link targets @@ -107,7 +117,7 @@ foreach(build ${DEAL_II_BUILD_TYPES}) target_link_libraries(${DEAL_II_NAMESPACE}_${build_lowercase} PRIVATE ${_object_targets} ) - endif() + endif() set_target_properties(${DEAL_II_NAMESPACE}_${build_lowercase} PROPERTIES -- 2.39.5