0

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?

Martin Fehrs
  • 792
  • 4
  • 13
  • I found CTEST_OUTPUT_ON_FAILURE. When I call: "make CTEST_OUTPUT_ON_FAILURE=1 test" I get the error, but I do not want to say it explicitly. – Martin Fehrs Mar 01 '20 at 13:56
  • Yes it does answer my question. Sadly my CMake version is too old for CMAKE_CTEST_ARGUMENT. I have to define a check target.. – Martin Fehrs Mar 01 '20 at 17:24

0 Answers0