From d3aa82bd0d60c5ce58543182529ea2f6653ead71 Mon Sep 17 00:00:00 2001 From: maier Date: Thu, 4 Apr 2013 08:42:33 +0000 Subject: [PATCH] CMake: Bugfixes in the autopilot macro - Provide a possibility to disable the run target - Set up path in a sane manner and invoke commands correctly - Do not run step-19 in the build tests git-svn-id: https://svn.dealii.org/trunk@29176 0785d39b-7218-0410-832d-ea1e28bc413d --- .../macro_deal_ii_invoke_autopilot.cmake | 29 ++++++++++++------- deal.II/contrib/utilities/build_test | 2 +- deal.II/examples/step-19/CMakeLists.txt | 2 +- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/deal.II/cmake/macros/macro_deal_ii_invoke_autopilot.cmake b/deal.II/cmake/macros/macro_deal_ii_invoke_autopilot.cmake index 373fb2fe60..f405c001e4 100644 --- a/deal.II/cmake/macros/macro_deal_ii_invoke_autopilot.cmake +++ b/deal.II/cmake/macros/macro_deal_ii_invoke_autopilot.cmake @@ -26,7 +26,8 @@ # ${TARGET} # TARGET_RUN - (optional) the command line that should be # invoked by "make run", will be set to default -# values if empty +# values if undefined. If no run target should be +# created, set it to an empty string. # CLEAN_UP_FILES - (optional) a list of files (globs) that will be # removed with "make runclean" and "make # distclean", will be set to default values if @@ -50,27 +51,34 @@ MACRO(DEAL_II_INVOKE_AUTOPILOT) MESSAGE(STATUS "Autopilot invoked") # Define a custom target to easily run the program: - IF("${TARGET_RUN}" STREQUAL "") + + IF(NOT DEFINED TARGET_RUN) SET(TARGET_RUN ${TARGET}) ENDIF() + # # Hack for Cygwin targets: Export PATH to point to the dynamic library. # This is more or less harmless, so do this unconditionally. # FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/run_target.cmake - "SET(ENV{PATH} \"${DEAL_II_PATH}/${DEAL_II_LIBRARY_RELDIR}:\$ENV{PATH}\")\n" - "EXECUTE_PROCESS(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_RUN}\n" + "SET(ENV{PATH} \"${CMAKE_CURRENT_BINARY_DIR}:${DEAL_II_PATH}/${DEAL_II_LIBRARY_RELDIR}:\$ENV{PATH}\")\n" + "EXECUTE_PROCESS(COMMAND ${TARGET_RUN}\n" " RESULT_VARIABLE _return_value\n" " )\n" "IF(NOT \"\${_return_value}\" STREQUAL "0")\n" " MESSAGE(SEND_ERROR \"\nProgram terminated with exit code: \${_return_value}\")\n" "ENDIF()\n" ) - ADD_CUSTOM_TARGET(run - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/run_target.cmake - DEPENDS ${TARGET} - COMMENT "Run ${TARGET} with ${CMAKE_BUILD_TYPE} configuration" - ) + IF(NOT "${TARGET_RUN}" STREQUAL "") + ADD_CUSTOM_TARGET(run + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/run_target.cmake + DEPENDS ${TARGET} + COMMENT "Run ${TARGET} with ${CMAKE_BUILD_TYPE} configuration" + ) + SET(_run_targets + "# $ make run - to (compile, link and) run the program\n" + ) + ENDIF() # Define custom targets to easily switch the build type: IF(${DEAL_II_BUILD_TYPE} MATCHES "Debug") @@ -132,8 +140,7 @@ MACRO(DEAL_II_INVOKE_AUTOPILOT) # # You can now run # $ make - to compile and link the program -# $ make run - to (compile, link and) run the program -# +${_run_targets}# ${_switch_targets}# # $ make edit_cache - to change (cached) configuration variables # and rerun the configure and generate phases of CMake diff --git a/deal.II/contrib/utilities/build_test b/deal.II/contrib/utilities/build_test index 2b0215bd33..b2c7487e43 100755 --- a/deal.II/contrib/utilities/build_test +++ b/deal.II/contrib/utilities/build_test @@ -96,7 +96,7 @@ build_examples: $(steps:%=%/%) runsteps_debug:= step-1 step-2 step-3 step-4 step-5 step-6 step-47 # Run all configuration independent steps in release configuration: -runsteps_release= step-1 step-2 step-3 step-4 step-5 step-6 step-7 step-8 step-9 step-10 step-11 step-12 step-13 step-14 step-16 step-19 step-20 step-23 step-25 step-26 step-27 step-28 step-30 step-38 step-39 step-44 step-45 step-47 step-48 step-49 +runsteps_release= step-1 step-2 step-3 step-4 step-5 step-6 step-7 step-8 step-9 step-10 step-11 step-12 step-13 step-14 step-16 step-20 step-23 step-25 step-26 step-27 step-28 step-30 step-38 step-39 step-44 step-45 step-47 step-48 step-49 # step-15 step-21 step-24 diff --git a/deal.II/examples/step-19/CMakeLists.txt b/deal.II/examples/step-19/CMakeLists.txt index 80fbe46b6c..ee7378945d 100644 --- a/deal.II/examples/step-19/CMakeLists.txt +++ b/deal.II/examples/step-19/CMakeLists.txt @@ -12,7 +12,7 @@ SET(TARGET_SRC ) # No sensible run target can be defined for this example step -SET(TARGET_RUN ";") +SET(TARGET_RUN "") # Usually, you will not need to modify anything beyond this point... -- 2.39.5