From 867298e3ed9939f502dbc22035b06932e5cce2a6 Mon Sep 17 00:00:00 2001
From: Timo Heister <timo.heister@gmail.com>
Date: Sun, 8 Dec 2013 00:48:40 +0000
Subject: [PATCH] quicktests: force the deletion of old -OK files

git-svn-id: https://svn.dealii.org/trunk@31928 0785d39b-7218-0410-832d-ea1e28bc413d
---
 deal.II/tests/quick_tests/CMakeLists.txt | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/deal.II/tests/quick_tests/CMakeLists.txt b/deal.II/tests/quick_tests/CMakeLists.txt
index 930c811caa..f8dec2f061 100644
--- a/deal.II/tests/quick_tests/CMakeLists.txt
+++ b/deal.II/tests/quick_tests/CMakeLists.txt
@@ -34,20 +34,31 @@ MACRO(make_quicktest test_basename build_name mpi_run)
   IF(NOT ${mpi_run} EQUAL "")
   ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK
     DEPENDS ${_target}
+    DEPENDS kill-${_target}-OK
     COMMAND mpirun -n ${mpi_run} ./${_target} > ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK 2>&1 || (rm ${_target}-OK  && exit 1)
     WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
     )
   ELSE()
-  ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK
+  ADD_CUSTOM_TARGET(${_target}-OK
     DEPENDS ${_target}
+    DEPENDS kill-${_target}-OK
     COMMAND ./${_target} > ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK 2>&1 || (cat ${_target}-OK && rm ${_target}-OK  && exit 1)
     WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
     )
   ENDIF()
 
+  # this is a hack to make sure the -OK file is deleted
+  ADD_CUSTOM_TARGET(kill-${_target}-OK
+	COMMAND rm -f ${_target}-OK 
+    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+    )
+
+  # make sure kill is run before the other two:
+  ADD_DEPENDENCIES(${_target} kill-${_target}-OK)
+
   ADD_CUSTOM_TARGET(${_target}.run
     DEPENDS ${_target}
-    DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK
+    DEPENDS ${_target}-OK
     COMMAND echo "${_target}: PASSED.")
 
   ADD_TEST(NAME ${_target}
-- 
2.39.5