[CMake] Is it possible to use ADD_TEST to execute multiple commands

Kent Williams kent at psychiatry.uiowa.edu
Mon Apr 24 14:47:16 EDT 2006


Here's the problem. I have  a test that invokes an external program.  So 
I have this in my CMakeLists.txt

ADD_TEST(ExampleTest exampleprogram a b c)

The problem is that exampleprogram requires the first parameter to be 
the name of an output file, and will exit with an error return code if 
that file already exists.

My 'naive' solution would be this:

ADD_TEST(ExampleTest rm -f a ; exampleprogram a b c)

which would essentially be a 2-command shell script.  This does not 
work, and I tried a lot of different ways to get the test to generate a 
command that would remove a file, and then run the test.

Any suggestions? Thanks in advance!



More information about the CMake mailing list