From e806dc637c0c7d2d32a589299e6491865dfa3d34 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Tue, 13 Aug 2013 03:18:30 +0000 Subject: [PATCH] CMake: fix build type handling in DEAL_II_* macros git-svn-id: https://svn.dealii.org/trunk@30299 0785d39b-7218-0410-832d-ea1e28bc413d --- ...acro_deal_ii_initialize_cached_variables.cmake | 10 ++++++++-- .../cmake/macros/macro_deal_ii_setup_target.cmake | 15 ++++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/deal.II/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake b/deal.II/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake index bcd842eb09..35e7e42a3a 100644 --- a/deal.II/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake +++ b/deal.II/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake @@ -51,9 +51,15 @@ MACRO(DEAL_II_INITIALIZE_CACHED_VARIABLES) ENDIF() # - # Reset build type if unsupported: + # Reset build type if unsupported, i.e. if it is not (case insensitively + # equal to Debug or Release or unsupported by the current build type: # - IF(NOT DEAL_II_BUILD_TYPE MATCHES "${CMAKE_BUILD_TYPE}") + STRING(TOLOWER "${CMAKE_BUILD_TYPE}" _cmake_build_type) + STRING(TOLOWER "${DEAL_II_BUILD_TYPE}" _deal_ii_build_type) + + IF( NOT "${_cmake_build_type}" MATCHES "^(debug|release)$" + OR NOT _deal_ii_build_type MATCHES "${_cmake_build_type}" + IF("${DEAL_II_BUILD_TYPE}" STREQUAL "DebugRelease") SET(_new_build_type "Debug") ELSE() diff --git a/deal.II/cmake/macros/macro_deal_ii_setup_target.cmake b/deal.II/cmake/macros/macro_deal_ii_setup_target.cmake index e98bd25576..28b88dd1d0 100644 --- a/deal.II/cmake/macros/macro_deal_ii_setup_target.cmake +++ b/deal.II/cmake/macros/macro_deal_ii_setup_target.cmake @@ -61,16 +61,16 @@ MACRO(DEAL_II_SETUP_TARGET _target) ) # - # Append build type dependend flags and definitions. + # Append build type dependent flags and definitions. # # # For this we obey the behaviour of the "optimized" and "debug" # keywords and this is a bit tricky: # - # If the global property DEBUG_CONFIGURATIONS is set all build - # types that (case insensitive) match one of the listed build types is - # considered a "debug" build. The rest is "optimized". + # If the global property DEBUG_CONFIGURATIONS is set all build types that + # (case insensitively) match one of the listed build types is considered + # a "debug" build. The rest is "optimized". # # Otherwise every build type that (case insensitively) matches "debug" is # considered a debug build. @@ -97,7 +97,12 @@ MACRO(DEAL_II_SETUP_TARGET _target) ENDIF() ENDIF() - IF(_on_debug_build) + # + # We can only append DEBUG link flags and compile definitions if deal.II + # was build with Debug or DebugRelease build type. So test for this: + # + IF( _on_debug_build + AND DEAL_II_BUILD_TYPE MATCHES "Debug" ) SET_PROPERTY(TARGET ${_target} APPEND_STRING PROPERTY LINK_FLAGS " ${DEAL_II_LINKER_FLAGS_DEBUG}" ) -- 2.39.5