[CMake] ADD_TEST and WORKING_DIRECTORY

Michael Hertling mhertling at online.de
Wed Oct 20 07:09:41 EDT 2010


On 10/20/2010 09:05 AM, Michael Wild wrote:
> 
> On 20. Oct, 2010, at 9:01 , Micha Renner wrote:
> 
>> Is there a way to specify a WORKING_DIRECTORY for ADD_TEST, similar
>> ADD_CUSTOM_COMMAND?
>>
>> Greetings
>>
>> Micha
> 
> 
> No, unfortunately not. You will have to wrap EXECUTE_PROCESS in a CMake script and use that script as the test using "${CMAKE_COMMAND} -P /path/to/script.cmake".

Perhaps, one could also use "cmake -E chdir" as a simple test driver:

ADD_TEST(NAME <testname>
         COMMAND ${CMAKE_COMMAND} -E chdir <working_directory>
                 $<TARGET_FILE:testtarget> <arg1> <arg2> <arg3> ...)

Regards,

Michael


More information about the CMake mailing list