CTest: Existence of test executable checked before fixture dependencies
The logic in cmCTestRunTest::StartTest()
calls ComputeArguments()
before checking if the test has any failed fixture dependencies. If the executable for the test case is missing, this results in the error message "Could not find executable ..." followed by all the places it looked, but if the test was not going to be run anyway, the error message should not be printed.
This scenario came up for a project where the test executable was built by another test case and that other test case was a fixture setup dependency. If building the executable failed, the dependent test case won't be run, but the error message about the executable being missing was still printed. This was unexpected by the user and I tend to agree.
For others coming across this issue, a workaround is to launch the test via CMake's command mode. The executable is then CMake itself, which always exists. For example:
add_test(NAME mightBeMissing
COMMAND ${CMAKE_COMMAND} -E env $<TARGET_FILE:realExeTarget>
)