Using CMake, I have a series of executables that are built, then added as tests, like this:
set(TestID 1)
add_executable (Test${TestID} Test${TestID}.cpp)
# Create test
configure_file(${TestID}.endf ${TestID}.endf COPYONLY)
add_test( NAME ${TestID} COMMAND Test${TestID} )
This works fine—the executables are created and the tests are correctly added. However, I don't want the test executables to be added to the all
target.
Instead of having my tests built along with everything else, I would like them built right before the execution of the tests; maybe as part of make test
or as part of ctest
.
How can I do this?