From d86da0af70f7b446c1e84687931e219ed37e7987 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Fri, 26 Sep 2025 16:03:21 +0200 Subject: [PATCH] GoogleTest: cleanup file generation For single config generators, don't write a file at configure time as it will be rewritten at generation time. For multi config generators, use `$` in the output instead of looping over `CMAKE_CONFIGURATION_TYPES`. --- Modules/GoogleTest.cmake | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/Modules/GoogleTest.cmake b/Modules/GoogleTest.cmake index 4d5878bee8..2fded3f2f7 100644 --- a/Modules/GoogleTest.cmake +++ b/Modules/GoogleTest.cmake @@ -756,24 +756,18 @@ function(gtest_discover_tests target) ) if(GENERATOR_IS_MULTI_CONFIG) - foreach(_config ${CMAKE_CONFIGURATION_TYPES}) - file(GENERATE - OUTPUT "${ctest_file_base}_include-${_config}.cmake" - CONTENT "${ctest_include_content}" - CONDITION $ - ) - endforeach() + file(GENERATE + OUTPUT "${ctest_file_base}_include-$.cmake" + CONTENT "${ctest_include_content}" + ) file(WRITE "${ctest_include_file}" "include(\"${ctest_file_base}_include-\${CTEST_CONFIGURATION_TYPE}.cmake\")" ) else() file(GENERATE - OUTPUT "${ctest_file_base}_include.cmake" + OUTPUT "${ctest_include_file}" CONTENT "${ctest_include_content}" ) - file(WRITE "${ctest_include_file}" - "include(\"${ctest_file_base}_include.cmake\")" - ) endif() else()