[CMake] How to specify working directory for unit tests?

Clinton Stimpson clinton at elemtech.com
Thu Dec 18 09:06:25 EST 2008


Tron Thomas wrote:
> I need to be able to run a certain unit from a specific directory so 
> that it will be able to find some supporting file that are needed for 
> the test.  However CTest insists on launching the test from a 
> different location.
>
> I tried using the --build-run-dir and --build-exe-dir flags.  Neither 
> of them would change the unit test directory.
>
> What can be done to specify the directory where CTest should launch 
> the unit test?

Doing something like this works for me:

ADD_TEST ( ${CMAKE_COMMAND} -E chdir ${MY_TEST_EXEC} ${MY_TEST_ARGS})

Clint




More information about the CMake mailing list