]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: Bugfixes in the autopilot macro
authorMatthias Maier <tamiko@kyomu.43-1.org>
Thu, 4 Apr 2013 08:42:33 +0000 (08:42 +0000)
committerMatthias Maier <tamiko@kyomu.43-1.org>
Thu, 4 Apr 2013 08:42:33 +0000 (08:42 +0000)
  - 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

deal.II/cmake/macros/macro_deal_ii_invoke_autopilot.cmake
deal.II/contrib/utilities/build_test
deal.II/examples/step-19/CMakeLists.txt

index 373fb2fe607976b8eac340b5112730889a0cda41..f405c001e4fd4f2b2126feb51e4388d5dda04d10 100644 (file)
@@ -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
index 2b0215bd335986df227bb3ee3acfcf6f92a4b4e7..b2c7487e432b5f38f109f0a27207afe1f05367df 100755 (executable)
@@ -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
 
 
index 80fbe46b6c09851c0004ba3125fd1591967a5492..ee7378945d77d95a2eb2c16241bfc9596b8104b5 100644 (file)
@@ -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...
 

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.