Merge pull request #4939 from fresh3nough:fix/cmake-python3-find-4847

PiperOrigin-RevId: 949359007
Change-Id: I3935301d293d9165db7dcda0c64cc821bdfe5186
This commit is contained in:
Copybara-Service
2026-07-16 22:01:49 -07:00
+6 -1
View File
@@ -255,7 +255,12 @@ function(cxx_executable name dir libs)
endfunction()
if(gtest_build_tests)
find_package(Python3)
# Only the interpreter is needed for Python tests. Specifying the component
# explicitly avoids a crash in CMake <= 3.23's FindPython3 module when no
# Python installation is present (the module calls list(GET) on an empty
# list). QUIET lets the build continue without Python tests instead of
# failing outright.
find_package(Python3 COMPONENTS Interpreter QUIET)
endif()
# cxx_test_with_flags(name cxx_flags libs srcs...)