Using CMake, how do I get verbose output from CTest?

You can use the ctest –output-on-failure option, or set the environment variable CTEST_OUTPUT_ON_FAILURE, which will show you any output from the test program whenever the test fails. One way to do this when using Makefiles and the command line would be as follows: env CTEST_OUTPUT_ON_FAILURE=1 make check This Stack Overflow question and answer shows how to … Read more

How to run ctest after building my project with cmake

This form of add_custom_command will only execute if another CMake target has a dependency on “tests.txt”. I assume that no other target has “tests.txt” as an input file, hence the custom command never runs. I think you could use the second form of add_custom_command to achieve your goal; something like: add_custom_command(TARGET MainTest POST_BUILD COMMAND ctest … Read more