fix: ensure gtest target exists so ricepp won't fetch it (fixes gh #194)

This commit is contained in:
Marcus Holland-Moritz 2024-02-12 13:30:21 +01:00
parent 5ede1fb84d
commit f713084f84
2 changed files with 8 additions and 1 deletions

View File

@ -354,7 +354,13 @@ set(ZSTD_LIBRARY_DEBUG
CACHE FILEPATH "don't build folly with zstd" FORCE)
if(WITH_TESTS)
if(NOT PREFER_SYSTEM_GTEST)
if(PREFER_SYSTEM_GTEST)
find_package(GTest 1.13.0 CONFIG REQUIRED)
add_library(gtest ALIAS GTest::gtest)
add_library(gtest_main ALIAS GTest::gtest_main)
add_library(gmock ALIAS GTest::gmock)
add_library(gmock_main ALIAS GTest::gmock_main)
else()
include(FetchContent)
FetchContent_Declare(
googletest

View File

@ -155,6 +155,7 @@ endif()
if(WITH_TESTS)
if(NOT TARGET gtest)
message(STATUS "[ricepp] fetching googletest")
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git