mirror of
https://github.com/gentoo-mirror/guru.git
synced 2026-07-10 15:45:15 -04:00
41 lines
1.2 KiB
Diff
41 lines
1.2 KiB
Diff
From: Paul Zander <negril.nx+gentoo@gmail.com>
|
|
Subject: [PATCH] CMake: use system gtest instead of fetching it
|
|
|
|
diff --git a/test/unittests/CMakeLists.txt b/test/unittests/CMakeLists.txt
|
|
index 4d07cdb..976b8e5 100644
|
|
--- a/test/unittests/CMakeLists.txt
|
|
+++ b/test/unittests/CMakeLists.txt
|
|
@@ -1,10 +1,7 @@
|
|
cmake_minimum_required(VERSION 3.11)
|
|
|
|
-include(FetchContent)
|
|
-FetchContent_Declare(gtest
|
|
- QUIET
|
|
- URL https://github.com/google/googletest/archive/refs/tags/release-1.11.0.zip
|
|
-)
|
|
+enable_testing()
|
|
+find_package(GTest REQUIRED)
|
|
|
|
# Prevent overriding the parent project's linker settings, for Windows.
|
|
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
|
@@ -15,10 +12,6 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
add_compile_options("-Wno-error=covered-switch-default")
|
|
endif()
|
|
|
|
-FetchContent_MakeAvailable(gtest)
|
|
-
|
|
-include(GoogleTest)
|
|
-
|
|
include_directories(../../src)
|
|
|
|
set(UNITTESTS_ROOT ${CMAKE_CURRENT_LIST_DIR})
|
|
@@ -39,7 +32,7 @@ function(add_lldb_mi_test NAME TEST)
|
|
endforeach(SRC)
|
|
|
|
add_executable(${NAME} ${TEST} ${SOURCES_RELATIVE})
|
|
- target_link_libraries(${NAME} gtest_main)
|
|
+ target_link_libraries(${NAME} GTest::gtest GTest::gtest_main)
|
|
set_target_properties(${NAME} PROPERTIES FOLDER "unittests")
|
|
|
|
gtest_discover_tests(${NAME})
|