From: Simon Quigley Date: Wed, 23 Aug 2023 18:08:28 +0000 (+0100) Subject: Use the googletest provided by the archive instead of the embedded copy X-Git-Tag: archive/raspbian/0.8.0+dfsg-3+rpi1^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=75a6b639c1670b81405d8e01e2d4fd5de4baee5f;p=yaml-cpp.git Use the googletest provided by the archive instead of the embedded copy Forwarded: https://github.com/jbeder/yaml-cpp/pull/1035 Last-Update: 2021-09-24 Gbp-Pq: Name use-archive-googletest.patch --- diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 351b03f..08aa5fe 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -4,11 +4,18 @@ set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) set(BUILD_MOCK ON CACHE BOOL "" FORCE) set(CMAKE_POLICY_DEFAULT_CMP0048 NEW) -add_subdirectory( - "${CMAKE_CURRENT_SOURCE_DIR}/gtest-1.11.0" - "${CMAKE_CURRENT_BINARY_DIR}/prefix") - -include_directories(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/gtest-1.11.0/googletest/include") +find_package(GTest) +if (NOT GTEST_FOUND) + add_subdirectory( + "${CMAKE_CURRENT_SOURCE_DIR}/gtest-1.11.0" + "${CMAKE_CURRENT_BINARY_DIR}/prefix") + include_directories(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/gtest-1.11.0/googletest/include") +else() + add_subdirectory( + "/usr/src/googletest" + "${CMAKE_CURRENT_BINARY_DIR}/prefix") + include_directories(SYSTEM "/usr/src/googletest/googlemock/include") +endif() set(test-new-api-pattern "new-api/*.cpp") set(test-source-pattern "*.cpp" "integration/*.cpp" "node/*.cpp")