From b2e918bafc65e69410c898c0ab4182c422afc80a Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Fri, 16 Dec 2022 20:01:47 -0700 Subject: [PATCH] Simplify how test runner command is created --- test/CMakeLists.txt | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2d347d69..e0148fcf 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -157,14 +157,10 @@ if(SFML_ENABLE_COVERAGE AND OpenCppCoverage_FOUND) string(REPLACE "/" "\\" COVERAGE_SRC "${PROJECT_SOURCE_DIR}/src") string(REPLACE "/" "\\" COVERAGE_INCLUDE "${PROJECT_SOURCE_DIR}/include") - add_custom_command(TARGET runtests - COMMENT "Run tests" - POST_BUILD COMMAND "${OpenCppCoverage_BINARY}" ARGS --quiet --export_type cobertura:${PROJECT_BINARY_DIR}/coverage.out --cover_children --excluded_modules "${COVERAGE_EXCLUDE}" --sources "${COVERAGE_SRC}" --sources "${COVERAGE_INCLUDE}" -- "${CMAKE_CTEST_COMMAND}" --output-on-failure -C $ - VERBATIM) -else() - # Run tests without a coverage runner - add_custom_command(TARGET runtests - COMMENT "Run tests" - POST_BUILD COMMAND "${CMAKE_CTEST_COMMAND}" --output-on-failure -C $ - VERBATIM) + set(COVERAGE_PREFIX ${OpenCppCoverage_BINARY} ARGS --quiet --export_type cobertura:${PROJECT_BINARY_DIR}/coverage.out --cover_children --excluded_modules "${COVERAGE_EXCLUDE}" --sources "${COVERAGE_SRC}" --sources "${COVERAGE_INCLUDE}" --) endif() + +add_custom_command(TARGET runtests + COMMENT "Run tests" + POST_BUILD COMMAND ${COVERAGE_PREFIX} ${CMAKE_CTEST_COMMAND} --output-on-failure -C $ + VERBATIM)