I have the following CMakeLists.txt:
enable_testing()
add_executable(legacy_iterator EXCLUDE_FROM_ALL test.cpp)
add_test(legacy_iterator_build
"${CMAKE_COMMAND}"
--build "${CMAKE_BINARY_DIR}"
--config "$<CONFIG>"
--target legacy_iterator
)
When I call make test, the test runs as expected. But if there's a compilation error I don't get any further information:
Start 1: legacy_iterator_build
1/1 Test #1: legacy_iterator_build ............***Failed 0.04 sec
0% tests passed, 1 tests failed out of 1
Total Test time (real) = 0.04 sec
The following tests FAILED:
1 - legacy_iterator_build (Failed)
Errors while running CTest
make: *** [Makefile:62: test] Fehler 8
How can I enforce ctest/cmake to show me the compilation error message from the compiler?