From: Rene Gassmoeller Date: Mon, 1 Apr 2024 21:32:54 +0000 (-0400) Subject: Export compile definitions for dependent targets X-Git-Tag: v9.6.0-rc1~349^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a29f491fc2a054b0545212d34261ea0270b0dc64;p=dealii.git Export compile definitions for dependent targets --- diff --git a/cmake/config/Config.cmake.in b/cmake/config/Config.cmake.in index 77f305e738..4601b27c8a 100644 --- a/cmake/config/Config.cmake.in +++ b/cmake/config/Config.cmake.in @@ -124,6 +124,14 @@ set(DEAL_II_LINKER_FLAGS_DEBUG "@DEAL_II_LINKER_FLAGS_DEBUG@") # _additionally_ used for release targets: set(DEAL_II_LINKER_FLAGS_RELEASE "@DEAL_II_LINKER_FLAGS_RELEASE@") +# used for all targets: +set(DEAL_II_DEFINITIONS "@DEAL_II_DEFINITIONS@") + +# _additionally_ used for debug targets: +set(DEAL_II_DEFINITIONS_DEBUG "@DEAL_II_DEFINITIONS_DEBUG@") + +# _additionally_ used for release targets: +set(DEAL_II_DEFINITIONS_RELEASE "@DEAL_II_DEFINITIONS_RELEASE@") # # MPI runtime: # diff --git a/cmake/macros/macro_deal_ii_setup_target.cmake b/cmake/macros/macro_deal_ii_setup_target.cmake index 4024eed956..a8192949e1 100644 --- a/cmake/macros/macro_deal_ii_setup_target.cmake +++ b/cmake/macros/macro_deal_ii_setup_target.cmake @@ -93,6 +93,10 @@ macro(deal_ii_setup_target _target) "${DEAL_II_WARNING_FLAGS} ${DEAL_II_CXX_FLAGS} ${DEAL_II_CXX_FLAGS_${_build}}" ) + target_compile_definitions(${_target} PRIVATE + ${DEAL_II_DEFINITIONS} ${DEAL_II_DEFINITIONS_${_build}} + ) + get_property(_type TARGET ${_target} PROPERTY TYPE) if(NOT "${_type}" STREQUAL "OBJECT_LIBRARY") target_link_flags(${_target} PRIVATE diff --git a/cmake/macros/macro_insource_setup_target.cmake b/cmake/macros/macro_insource_setup_target.cmake index c037ac0a46..db2ac168e0 100644 --- a/cmake/macros/macro_insource_setup_target.cmake +++ b/cmake/macros/macro_insource_setup_target.cmake @@ -34,6 +34,10 @@ function(insource_setup_target _target _build) "${DEAL_II_WARNING_FLAGS} ${DEAL_II_CXX_FLAGS} ${DEAL_II_CXX_FLAGS_${_build}}" ) + target_compile_definitions(${_target} PRIVATE + ${DEAL_II_DEFINITIONS} ${DEAL_II_DEFINITIONS_${_build}} + ) + get_property(_type TARGET ${_target} PROPERTY TYPE) if(NOT "${_type}" STREQUAL "OBJECT_LIBRARY") target_link_flags(${_target} PRIVATE