aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrea Pappacoda <[email protected]>2021-09-19 17:17:02 +0200
committerMatthew Gregan <[email protected]>2021-11-01 20:28:31 +1300
commit72f959807d5723c77576e52b1c2b33c28b55f246 (patch)
tree8051f38fec14987a6a3a03ebad0985f6e420f4f1
parentd512bfa07a327e0ae7e7aef892dcce01cbeaa67c (diff)
downloadcubeb-72f959807d5723c77576e52b1c2b33c28b55f246.tar.gz
cubeb-72f959807d5723c77576e52b1c2b33c28b55f246.zip
build(cmake): use system GTest when available
This speeds up compilation times and makes downstream packaging easier.
-rw-r--r--CMakeLists.txt4
1 files changed, 4 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1b18c9d..b541bca 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,6 +31,10 @@ if(NOT COMMAND add_sanitizers)
endif()
if(BUILD_TESTS)
+ find_package(GTest QUIET)
+ if(TARGET GTest::Main)
+ add_library(gtest_main ALIAS GTest::Main)
+ endif()
if(NOT TARGET gtest_main)
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/googletest/CMakeLists.txt")
message(FATAL_ERROR "Could not find googletest: run\n\tgit submodule update --init --recursive\nin base git checkout")