summarylogtreecommitdiffstats
path: root/0001-makepkg-Use-system-gtest.patch
blob: 9de3beaf8873d56c4638ab080d50b181b1ba6669 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
From bce0edec2ede4b5951914d01e4021d21e7fed225 Mon Sep 17 00:00:00 2001
From: Julianne H <julianne.hervier@qonfucius.team>
Date: Fri, 3 Mar 2023 15:24:02 +0100
Subject: [PATCH] makepkg: Use system gtest

---
 CMakeLists.txt | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7b0a6ea..55414de 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -88,16 +88,20 @@ endif()
 option(PHMAP_BUILD_TESTS    "Whether or not to build the tests"    ${PHMAP_MASTER_PROJECT})
 option(PHMAP_BUILD_EXAMPLES "Whether or not to build the examples" ${PHMAP_MASTER_PROJECT})
 
+option(PHMAP_USE_SYSTEM_GTEST "Use system gtest" ON)
+
 if(MSVC)
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
 endif()
 
 if (PHMAP_BUILD_TESTS)
+    include_directories(${PROJECT_SOURCE_DIR})
 
-    if (NOT PHMAP_GTEST_LIBS)
+    if (PHMAP_USE_SYSTEM_GTEST)
+        find_package(GTest REQUIRED)
+        set(PHMAP_GTEST_LIBS GTest::gtest GTest::gtest_main GTest::gmock)
+    else ()
         include(cmake/DownloadGTest.cmake)
-        include_directories(${PROJECT_SOURCE_DIR})
-    
         check_target(gtest)
         check_target(gtest_main)
         check_target(gmock)
@@ -200,4 +204,3 @@ if (PHMAP_BUILD_EXAMPLES)
     target_link_libraries(ex_knucleotide Threads::Threads)
     target_link_libraries(ex_bench Threads::Threads)
 endif()
-
-- 
2.40.0