1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-17 07:11:52 +08:00

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 `$<CONFIG>` in the output instead
of looping over `CMAKE_CONFIGURATION_TYPES`.
This commit is contained in:
Daniel Pfeifer
2025-09-26 16:03:21 +02:00
parent bd80d21c0c
commit d86da0af70

View File

@@ -756,24 +756,18 @@ function(gtest_discover_tests target)
) )
if(GENERATOR_IS_MULTI_CONFIG) if(GENERATOR_IS_MULTI_CONFIG)
foreach(_config ${CMAKE_CONFIGURATION_TYPES}) file(GENERATE
file(GENERATE OUTPUT "${ctest_file_base}_include-$<CONFIG>.cmake"
OUTPUT "${ctest_file_base}_include-${_config}.cmake" CONTENT "${ctest_include_content}"
CONTENT "${ctest_include_content}" )
CONDITION $<CONFIG:${_config}>
)
endforeach()
file(WRITE "${ctest_include_file}" file(WRITE "${ctest_include_file}"
"include(\"${ctest_file_base}_include-\${CTEST_CONFIGURATION_TYPE}.cmake\")" "include(\"${ctest_file_base}_include-\${CTEST_CONFIGURATION_TYPE}.cmake\")"
) )
else() else()
file(GENERATE file(GENERATE
OUTPUT "${ctest_file_base}_include.cmake" OUTPUT "${ctest_include_file}"
CONTENT "${ctest_include_content}" CONTENT "${ctest_include_content}"
) )
file(WRITE "${ctest_include_file}"
"include(\"${ctest_file_base}_include.cmake\")"
)
endif() endif()
else() else()