<div dir="ltr">I am trying to run a test in a specific working directory. The command I used was:<div><br></div><div><div>add_test(NAME MyTest</div><div> WORKING_DIRECTORY ${MyDir}/Test/${CMAKE_CFG_INTDIR}</div><div><span style="white-space:pre"> </span>COMMAND MyTest</div>
<div>)</div></div><div><br></div><div>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</div><div>
<br></div><div>SET_TESTS_PROPERTIES(MyTest PROPERTIES WORKING_DIRECTORY "/MyDir/Test/\$(CONFIGURATION)\$(EFFECTIVE_PLATFORM_NAME)")<br></div><div><br></div><div>The problem seems to be that CMAKE_CFG_INTDIR doesn't work correctly when used within add_test (and specifically for the WORKING_DIRECTORY).</div>
<div><br></div><div>I changed the above line by manually inserting "Debug", so it read</div><div><br></div><div>SET_TESTS_PROPERTIES(MyTest PROPERTIES WORKING_DIRECTORY "/MyDir/Test/Debug")<br></div><div>
<br></div><div>and the test passed. Am I using the WORKING_DIRECTORY option correctly? Should it be working with CMAKE_CFG_INTDIR?</div><div><br></div><div>Thanks.</div></div>