Some tests that I run need to access files (using a relative path) that are located in the same directory as the test executable itself. So I'm trying to use ADD_TEST property WORKING_DIRECTORY in the following way:<div>
<br></div><div>ADD_TEST(</div><div> NAME mytest</div><div> WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}</div><div> COMMAND myexec)</div><div><br></div><div>When using a multiple configuration build system like Visual Studio, I expect the working directory to be set, in the example of a debug build, to "c:/path/to/runtime/dir/Debug", but it fails. To test that I've printed the return of getcwd(), which would be"c:/path/to/runtime/" in this particular example. I've also tried to hard code "c:/path/to/runtime/dir/Debug" as the working direcory property of the add_test command, it works fine.</div>
<div><br></div><div>So I'm wondering if CMAKE_CFG_INTDIR can be used in that case, or if there are other solutions to acheive this objective ?</div><div><br></div><div>I know I could use $<TARGET_FILE_DIR:myexec> as an argument of my test command, but this is not the test I want to do.</div>
<div><br></div><div>I also tried the command explained in that thread: <a href="http://www.mail-archive.com/cmake@cmake.org/msg24194.html">http://www.mail-archive.com/cmake@cmake.org/msg24194.html</a>. I did this simple test case : add_test(mytest ${CMAKE_COMMAND} -E chdir "c:/" $<TARGET_FILE:myexec>), but it fails to execute. I don't really understand this syntax, it seems that it tries to run 2 commands sequentially. Is this is supposed to work ?</div>
<div><br></div><div>My environment is CMake 2.8.8, Visual Studio 2010, Windows XP.</div>
<div><br></div><div>Best regards</div><div>Guillaume</div>