[CMake] Conditional post test behavior
Belcourt, K. Noel
kbelco at sandia.gov
Sat May 7 18:13:29 EDT 2011
Hi,
I apologize if this has been asked and answered. Is there a way to
execute some commands after a test has run where the commands can be
different depending on whether the test passes or not? Here's my test.
add_test(
NAME ex7_2_fmelcor
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
COMMAND fmelcor.x ex7_variant2.inp
)
Because these tests generate enormous files (in both quantity and
size) and run for very long times (days in some cases) I want all
generated files to be deleted after the test runs, but only if the
test passes. If the test fails, I need to leave the files around so I
can use them to debug the test. So can I conditionally call this file
remove function only if the test passes?
file(REMOVE ${Ex7_2_Files})
Is there CMake support for this that I'm not seeing or is this even
possible?
-- Noel
More information about the CMake
mailing list