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:
ADD_TEST(
NAME mytest
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}
COMMAND myexec)
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.
So I'm wondering if CMAKE_CFG_INTDIR can be used in that case, or if there
are other solutions to acheive this objective ?
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.
I also tried the command explained in that thread:
http://www.mail-archive.com/[email protected]/msg24194.html. 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 ?
My environment is CMake 2.8.8, Visual Studio 2010, Windows XP.
Best regards
Guillaume
--
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake