Question

I am currently having trouble changing the directory CTest in when using the RUN_TESTS project generated by CMake. Currently CMAKE_RUNTIME_OUTPUT_DIRECTORY is set to a custom path. As a result when CTest attempts to run, it is doing so from a directory that contains no binaries.

As a temporary workaround I am calling ADD_TEST using ${RUNTIME_OUTPUT_DIRECTORY}\test but I am not sure if this is the correct solution. Is there a way a better way change the default directory used by CTest?

Was it helpful?

Solution

If your ADD_EXECUTABLE target is say my_exe and your test name my_test, you should be able to call ADD_TEST like:

ADD_TEST(NAME my_test COMMAND my_exe)

For further info, run

cmake --help-command ADD_TEST
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top