aboutsummaryrefslogtreecommitdiffstats
path: root/community/cmake-extras/0002-GMock-Use-GMock-targets-from-CMake-if-possible.patch
diff options
context:
space:
mode:
Diffstat (limited to 'community/cmake-extras/0002-GMock-Use-GMock-targets-from-CMake-if-possible.patch')
-rw-r--r--community/cmake-extras/0002-GMock-Use-GMock-targets-from-CMake-if-possible.patch35
1 files changed, 35 insertions, 0 deletions
diff --git a/community/cmake-extras/0002-GMock-Use-GMock-targets-from-CMake-if-possible.patch b/community/cmake-extras/0002-GMock-Use-GMock-targets-from-CMake-if-possible.patch
new file mode 100644
index 0000000000..811a0235f9
--- /dev/null
+++ b/community/cmake-extras/0002-GMock-Use-GMock-targets-from-CMake-if-possible.patch
@@ -0,0 +1,35 @@
+From 52a1fcc2c00cc7476c3e626b98fecffe1ae83fa6 Mon Sep 17 00:00:00 2001
+From: Luca Weiss <luca@z3ntu.xyz>
+Date: Sun, 4 Apr 2021 14:53:01 +0200
+Subject: [PATCH 2/2] GMock: Use GMock targets from CMake if possible
+
+---
+ src/GMock/GMockConfig.cmake | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/src/GMock/GMockConfig.cmake b/src/GMock/GMockConfig.cmake
+index 3bd8f37..114737d 100644
+--- a/src/GMock/GMockConfig.cmake
++++ b/src/GMock/GMockConfig.cmake
+@@ -72,6 +72,18 @@ function(do_version_detection)
+ add_definitions(-DGTEST_VERSION_PATCH=${GTEST_VERSION_PATCH})
+ endfunction()
+
++# Try using CMake targets provided by GTest
++find_package (GTest)
++if (GTest_FOUND AND TARGET GTest::gmock)
++ set(GTEST_LIBRARIES GTest::gtest)
++ set(GTEST_MAIN_LIBRARIES GTest::gtest_main)
++ set(GMOCK_LIBRARIES GTest::gmock_main GTest::gmock)
++ set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
++
++ do_version_detection()
++ return()
++endif()
++
+ find_package(Threads)
+ find_package(PkgConfig)
+
+--
+2.31.1
+