How to pass command-line arguments in CTest at runtime
I’ve figured out a way to do it (using the Fundamental theorem of software engineering). It’s not as simple as I’d like, but here it is. First, create a file ${CMAKE_SOURCE_DIR}/cmake/RunTests.cmake with the content if(NOT DEFINED ENV{TESTS_ARGUMENTS}) set(ENV{TESTS_ARGUMENTS} “–default-arguments”) endif() execute_process(COMMAND ${TEST_EXECUTABLE} $ENV{TESTS_ARGUMENTS} RESULT_VARIABLE result) if(NOT “${result}” STREQUAL “0”) message(FATAL_ERROR “Test failed with return value … Read more