]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: fix build type handling in DEAL_II_* macros
authorMatthias Maier <tamiko@kyomu.43-1.org>
Tue, 13 Aug 2013 03:18:30 +0000 (03:18 +0000)
committerMatthias Maier <tamiko@kyomu.43-1.org>
Tue, 13 Aug 2013 03:18:30 +0000 (03:18 +0000)
git-svn-id: https://svn.dealii.org/trunk@30299 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake
deal.II/cmake/macros/macro_deal_ii_setup_target.cmake

index bcd842eb097fcd5ef0ccdac9a02fa98d705f5411..35e7e42a3a30838ed7de74550b5846d5bbcf46d0 100644 (file)
@@ -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()
index e98bd2557632d6ca15e6cf9749bf275b560ece09..28b88dd1d09ad93770c160729c46a8e47bafdc49 100644 (file)
@@ -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}"
       )

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.