[CMake] CTest working directory and CMAKE_CFD_INTDIR

Kurt Ehlert kehlert at wisc.edu
Wed Nov 13 16:41:03 EST 2013


I am trying to run a test in a specific working directory. The command I
used was:

add_test(NAME MyTest
    WORKING_DIRECTORY ${MyDir}/Test/${CMAKE_CFG_INTDIR}
  COMMAND MyTest
)

When I tried running CTest within Xcode, the test did not pass, and instead
CTest gave me an error (BAD_COMMAND). I then looked at CTestTestfile.cmake
for a clue, and I found

SET_TESTS_PROPERTIES(MyTest PROPERTIES  WORKING_DIRECTORY
"/MyDir/Test/\$(CONFIGURATION)\$(EFFECTIVE_PLATFORM_NAME)")

The problem seems to be that CMAKE_CFG_INTDIR doesn't work correctly when
used within add_test (and specifically for the WORKING_DIRECTORY).

I changed the above line by manually inserting "Debug", so it read

SET_TESTS_PROPERTIES(MyTest PROPERTIES  WORKING_DIRECTORY
"/MyDir/Test/Debug")

and the test passed. Am I using the WORKING_DIRECTORY option correctly?
Should it be working with CMAKE_CFG_INTDIR?

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20131113/f9c2d08b/attachment.htm>


More information about the CMake mailing list