]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: error message + guard target 7694/head
authorMatthias Maier <tamiko@43-1.org>
Tue, 5 Feb 2019 21:12:52 +0000 (15:12 -0600)
committerMatthias Maier <tamiko@43-1.org>
Fri, 8 Feb 2019 04:35:03 +0000 (22:35 -0600)
 - Add a helpful message to make debug/release targets.

 - Only create the corresponding debug/release target if the build type
   is available.

cmake/macros/macro_deal_ii_invoke_autopilot.cmake

index a494f0a9e8f473f8eff2fb1ce0e87e04cf7e90ba..ca5a1c0832a9fb0a5a553a83688d376bac7b4d2b 100644 (file)
@@ -138,19 +138,37 @@ MACRO(DEAL_II_INVOKE_AUTOPILOT)
       )
   ENDIF()
 
+  #
   # Define custom targets to easily switch the build type:
-  ADD_CUSTOM_TARGET(debug
-    COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR}
-    COMMENT "Switch CMAKE_BUILD_TYPE to Debug"
-    )
+  #
 
-  ADD_CUSTOM_TARGET(release
-    COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR}
-    COMMENT "Switch CMAKE_BUILD_TYPE to Release"
-    )
+  IF(${DEAL_II_BUILD_TYPE} MATCHES "Debug")
+    ADD_CUSTOM_TARGET(debug
+      COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR}
+      COMMAND ${CMAKE_COMMAND} -E echo "***"
+      COMMAND ${CMAKE_COMMAND} -E echo "*** Switched to Debug mode. Now recompile with: ${_make_command}"
+      COMMAND ${CMAKE_COMMAND} -E echo "***"
+      COMMENT "Switch CMAKE_BUILD_TYPE to Debug"
+      VERBATIM
+      )
+  ENDIF()
 
+  IF(${DEAL_II_BUILD_TYPE} MATCHES "Release")
+    ADD_CUSTOM_TARGET(release
+      COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR}
+      COMMAND ${CMAKE_COMMAND} -E echo "***"
+      COMMAND ${CMAKE_COMMAND} -E echo "*** Switched to Release mode. Now recompile with: ${_make_command}"
+      COMMAND ${CMAKE_COMMAND} -E echo "***"
+      COMMENT "Switch CMAKE_BUILD_TYPE to Release"
+      VERBATIM
+      )
+  ENDIF()
+
+  #
   # Only mention release and debug targets if it is actually possible to
   # switch between them:
+  #
+
   IF(${DEAL_II_BUILD_TYPE} MATCHES "DebugRelease")
     SET(_switch_targets
 "#      ${_make_command} debug          - to switch the build type to '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.