From: Matthias Maier Date: Tue, 5 Feb 2019 21:12:52 +0000 (-0600) Subject: CMake: error message + guard target X-Git-Tag: v9.1.0-rc1~356^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F7694%2Fhead;p=dealii.git CMake: error message + guard target - Add a helpful message to make debug/release targets. - Only create the corresponding debug/release target if the build type is available. --- diff --git a/cmake/macros/macro_deal_ii_invoke_autopilot.cmake b/cmake/macros/macro_deal_ii_invoke_autopilot.cmake index a494f0a9e8..ca5a1c0832 100644 --- a/cmake/macros/macro_deal_ii_invoke_autopilot.cmake +++ b/cmake/macros/macro_deal_ii_invoke_autopilot.cmake @@ -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'