From 630c7f0fd42655e0dd6ce303e5d36aab719f6f9f Mon Sep 17 00:00:00 2001 From: Holger Kaelberer Date: Mon, 25 Sep 2023 16:31:46 +0200 Subject: [PATCH] fixup! Catch.cmake: Support CMake multi-config with PRE_TEST discovery mode --- extras/Catch.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/extras/Catch.cmake b/extras/Catch.cmake index cb9f4ef11d..8f30688c52 100644 --- a/extras/Catch.cmake +++ b/extras/Catch.cmake @@ -263,7 +263,14 @@ function(catch_discover_tests TARGET) foreach(_config ${CMAKE_CONFIGURATION_TYPES}) file(GENERATE OUTPUT "${ctest_file_base}_include-${_config}.cmake" CONTENT "${ctest_include_content}" CONDITION $) endforeach() - file(WRITE "${ctest_include_file}" "include(\"${ctest_file_base}_include-\${CTEST_CONFIGURATION_TYPE}.cmake\")") + string(CONCAT ctest_include_multi_content + "if(NOT CTEST_CONFIGURATION_TYPE)" "\n" + " message(\"No configuration for testing specified, use '-C '.\")" "\n" + "else()" "\n" + " include(\"${ctest_file_base}_include-\${CTEST_CONFIGURATION_TYPE}.cmake\")" "\n" + "endif()" "\n" + ) + file(GENERATE OUTPUT "${ctest_include_file}" CONTENT "${ctest_include_multi_content}") else() file(GENERATE OUTPUT "${ctest_file_base}_include.cmake" CONTENT "${ctest_include_content}") file(WRITE "${ctest_include_file}" "include(\"${ctest_file_base}_include.cmake\")")