]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Quicktests: Remove target-OK prior to compilation
authorMatthias Maier <tamiko@kyomu.43-1.org>
Sun, 8 Dec 2013 16:01:48 +0000 (16:01 +0000)
committerMatthias Maier <tamiko@kyomu.43-1.org>
Sun, 8 Dec 2013 16:01:48 +0000 (16:01 +0000)
Remove target-OK prior to compilation of target with the help of
RULE_LAUNCH_COMPILE. This is a cleaner solution because the removal is only
triggered if target is actually (re)built.

Additionally, reintroduce the ADD_CUSTOM_COMMAND and ADD_CUSTOM_TARGET
splitting so that also quicktests only rerun if they actually have to...

git-svn-id: https://svn.dealii.org/trunk@31941 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/tests/quick_tests/CMakeLists.txt

index 2a37c13820a3c69f8b41c879d500f8cbc7799d24..f3b7d4a8fe5de9561b4e9702e9fb188bb59f24fb 100644 (file)
@@ -30,32 +30,36 @@ MACRO(make_quicktest test_basename build_name mpi_run)
   STRING(TOLOWER ${build_name} _build_lowercase)
   SET(_target ${test_basename}.${_build_lowercase})
   LIST(APPEND ALL_TESTS "${_target}")
+
   ADD_EXECUTABLE(${_target} EXCLUDE_FROM_ALL ${test_basename}.cc)
   DEAL_II_INSOURCE_SETUP_TARGET(${_target} ${build_name})
 
+  # Remove ${_target}-OK prior to compilation:
+  SET_PROPERTY(TARGET ${_target} PROPERTY RULE_LAUNCH_COMPILE
+    "rm -f ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK &&"
+    )
+
   IF("${mpi_run}" STREQUAL "")
     SET(_command ./${_target})
   ELSE()
     SET(_command mpirun -n ${mpi_run} ./${_target})
   ENDIF()
-  ADD_CUSTOM_TARGET(${_target}.run
-    DEPENDS kill-${_target}-OK
-    DEPENDS ${_target}
+
+  ADD_CUSTOM_COMMAND(
+    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK
     COMMAND
       ${_command} > ${_target}-OK 2>&1
       ||(echo "${_target}: RUN failed. Output:"
          && cat ${_target}-OK
          && rm ${_target}-OK
          && exit 1)
-    COMMAND echo "${_target}: PASSED."
+    DEPENDS ${_target}
     WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
     )
 
-  # this is a hack to make sure the -OK file is deleted
-  # even if compilation fails.
-  ADD_CUSTOM_TARGET(kill-${_target}-OK
-        COMMAND rm -f ${_target}-OK 
-    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+  ADD_CUSTOM_TARGET(${_target}.run
+    COMMAND echo "${_target}: PASSED."
+    DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK
     )
 
   # make sure kill is run before running the task

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.