Skip to content

Commit

Permalink
Only add the compile options to the dealii::dealii target
Browse files Browse the repository at this point in the history
  • Loading branch information
masterleinad committed Mar 30, 2023
1 parent fa68000 commit eafcbb2
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,19 @@ add_subdirectory(sundials)
add_subdirectory(trilinos)
add_subdirectory(arborx)

#
# Define a "dealii", i.e., "${DEAL_II_NAMESPACE}", target that contains
# DEAL_II_CXX_FLAGS[_DEBUG|_RELEASE] and otherwsie aliases dealii_debug or
# dealii_release depending on the downstream CMAKE_BUILD_TYPE.
#

add_library(${DEAL_II_NAMESPACE} INTERFACE)
separate_arguments(_compile_options UNIX_COMMAND "${DEAL_II_CXX_FLAGS}")
shell_escape_option_groups(_compile_options)
target_compile_options(${DEAL_II_NAMESPACE} INTERFACE
$<$<COMPILE_LANGUAGE:CXX>:${_compile_options}>
)


foreach(build ${DEAL_II_BUILD_TYPES})
string(TOLOWER ${build} build_lowercase)
Expand Down Expand Up @@ -131,12 +143,22 @@ foreach(build ${DEAL_II_BUILD_TYPES})
)

separate_arguments(_compile_options UNIX_COMMAND
"${DEAL_II_CXX_FLAGS} ${DEAL_II_CXX_FLAGS_${build_uppercase}}"
"${DEAL_II_CXX_FLAGS_${build_uppercase}}"
)
shell_escape_option_groups(_compile_options)
target_compile_options(${DEAL_II_NAMESPACE}_${build_lowercase} PUBLIC
$<$<COMPILE_LANGUAGE:CXX>:${_compile_options}>
if(${build_lowercase} MATCHES "debug")
target_compile_options(${DEAL_II_NAMESPACE} INTERFACE
"$<$<CONFIG:Debug>:$<$<COMPILE_LANGUAGE:CXX>:${_compile_options}>>"
)
target_compile_options(${DEAL_II_NAMESPACE} INTERFACE
"$<$<CONFIG:>:$<$<COMPILE_LANGUAGE:CXX>:${_compile_options}>>"
)
endif()
if(${build_lowercase} MATCHES "release")
target_compile_options(${DEAL_II_NAMESPACE} INTERFACE
"$<$<CONFIG:Release>:$<$<COMPILE_LANGUAGE:CXX>:${_compile_options}>>"
)
endif()

if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
set_target_properties(${DEAL_II_NAMESPACE}_${build_lowercase}
Expand Down

0 comments on commit eafcbb2

Please sign in to comment.