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

Andy Cedilnik andy.cedilnik at kitware.com
Mon Apr 24 14:56:19 EDT 2006


Hi Kent,

If you have a control over the example program, you should fix the code. 
Otherwise, just add a wrapper program that removes the file and then 
invokes exampleprogram.

Also, please put a feature request to the bug tracker.

       Andy

Kent Williams wrote:

> 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!
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake



-- 
Andy Cedilnik
Kitware Inc.



More information about the CMake mailing list