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.
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to