Building off of this answer, I have a setup where I:
- have
CMAKE_RUNTIME_OUTPUT_DIRECTORY
set to${CMAKE_BINARY_DIR}/bin
have a test added via:
add_executable(my_test test.cxx) add_test(my_test my_test)
With that, make test
fails. I get the exact same kind of output as in the linked question:
Could not find executable test
Looked in the following places:
my_test
my_test
Release/my_test
Release/my_test
[...]
As suggested in the answer, I changed to:
add_test(NAME my_test COMMAND my_test)
With that fix, I can now run:
$ make my_test # necessary!
$ make test
This works great. It is able to find and run my tests. However, if I don't run make my_test
first, make test
still fails - it won't build anything.
What do I do to get make test
to actually both build and run all the tests?