From dfcf2d4d576e32b3f0d8a806df51ca1ea2d45941 Mon Sep 17 00:00:00 2001 From: YedilB Date: Thu, 20 Aug 2026 16:41:48 +0700 Subject: [PATCH] Register googlemock Python tests with CTest py_test() relies on Python3_Interpreter_FOUND and the imported Python3::Interpreter target, both of which are directory-scoped and set in googletest's scope. googlemock adds googletest as a subdirectory, so neither is visible where py_test() is called from, and gmock_leak_test and gmock_output_test were never registered. Repeat the interpreter search in googlemock's own scope. Fixes #5070 --- googlemock/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/googlemock/CMakeLists.txt b/googlemock/CMakeLists.txt index 33ec9636..d0824605 100644 --- a/googlemock/CMakeLists.txt +++ b/googlemock/CMakeLists.txt @@ -202,6 +202,11 @@ if (gmock_build_tests) ############################################################ # Python tests. + # Python is found in googletest's directory scope, which does not propagate + # to this parent scope, and the imported Python3::Interpreter target used by + # py_test() is directory-scoped as well, so the search is repeated here. + find_package(Python3 COMPONENTS Interpreter QUIET) + cxx_executable(gmock_leak_test_ test gmock_main) py_test(gmock_leak_test)