]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: export C++ standard as COMPILE_FEATURE target property 14992/head
authorMatthias Maier <tamiko@43-1.org>
Thu, 30 Mar 2023 03:25:31 +0000 (22:25 -0500)
committerMatthias Maier <tamiko@43-1.org>
Thu, 30 Mar 2023 03:40:05 +0000 (22:40 -0500)
source/CMakeLists.txt

index ca59fe2abef92f59d6434628fda2feba1e21a62a..e73819c42499ec1cc2e46e996bb7cec97fba43c9 100644 (file)
@@ -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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.