Blame SOURCES/google-benchmark-packaged-gtest.patch

rdobuilder 2a3bc1
From e8619813072f8eb7cf2d0e30b331c791405f5fef Mon Sep 17 00:00:00 2001
rdobuilder 2a3bc1
From: Vitaly Zaitsev <vitaly@easycoding.org>
rdobuilder 2a3bc1
Date: Wed, 8 Sep 2021 19:41:07 +0200
rdobuilder 2a3bc1
Subject: [PATCH] Added support of packaged GTest for running unit tests.
rdobuilder 2a3bc1
rdobuilder 2a3bc1
Signed-off-by: Vitaly Zaitsev <vitaly@easycoding.org>
rdobuilder 2a3bc1
---
rdobuilder 2a3bc1
 CMakeLists.txt | 10 +++++++++-
rdobuilder 2a3bc1
 1 file changed, 9 insertions(+), 1 deletion(-)
rdobuilder 2a3bc1
rdobuilder 2a3bc1
diff --git a/CMakeLists.txt b/CMakeLists.txt
rdobuilder 2a3bc1
index 49f2ae2a0..0570d050d 100644
rdobuilder 2a3bc1
--- a/CMakeLists.txt
rdobuilder 2a3bc1
+++ b/CMakeLists.txt
rdobuilder 2a3bc1
@@ -307,7 +307,15 @@ if (BENCHMARK_ENABLE_TESTING)
rdobuilder 2a3bc1
   if (BENCHMARK_ENABLE_GTEST_TESTS AND
rdobuilder 2a3bc1
       NOT (TARGET gtest AND TARGET gtest_main AND
rdobuilder 2a3bc1
            TARGET gmock AND TARGET gmock_main))
rdobuilder 2a3bc1
-    include(GoogleTest)
rdobuilder 2a3bc1
+    find_package(GTest QUIET)
rdobuilder 2a3bc1
+    if (GTEST_FOUND)
rdobuilder 2a3bc1
+      add_library(gtest ALIAS GTest::gtest)
rdobuilder 2a3bc1
+      add_library(gtest_main ALIAS GTest::gtest_main)
rdobuilder 2a3bc1
+      add_library(gmock ALIAS GTest::gmock)
rdobuilder 2a3bc1
+      add_library(gmock_main ALIAS GTest::gmock_main)
rdobuilder 2a3bc1
+    else()
rdobuilder 2a3bc1
+      include(GoogleTest)
rdobuilder 2a3bc1
+    endif()
rdobuilder 2a3bc1
   endif()
rdobuilder 2a3bc1
   add_subdirectory(test)
rdobuilder 2a3bc1
 endif()