Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the directory CTest runs from in generated Visual Studio Files

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?

like image 526
JMcCarty Avatar asked Nov 18 '25 01:11

JMcCarty


1 Answers

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
like image 121
Fraser Avatar answered Nov 20 '25 11:11

Fraser



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!