--- CMakeLists.txt_orig	2025-10-16 17:31:07
+++ CMakeLists.txt	2025-10-16 17:31:59
@@ -96,12 +96,17 @@
 if (PHMAP_BUILD_TESTS)
 
     if (NOT PHMAP_GTEST_LIBS)
-        include(cmake/DownloadGTest.cmake)
+        find_package(GTest CONFIG)
+        if (GTest_FOUND)
+            set(PHMAP_GTEST_LIBS GTest::gmock_main)
+        else()
+            include(cmake/DownloadGTest.cmake)
 
-        check_target(gtest)
-        check_target(gtest_main)
-        check_target(gmock)
-        set(PHMAP_GTEST_LIBS gmock_main)
+            check_target(gtest)
+            check_target(gtest_main)
+            check_target(gmock)
+            set(PHMAP_GTEST_LIBS gmock_main)
+        endif()
     endif()
 
     enable_testing()