From 0f111de224fc390a15b691dbb4dfd28904f943a7 Mon Sep 17 00:00:00 2001 From: "Hendrik v. Raven" Date: Wed, 26 Jul 2017 10:50:00 +0200 Subject: [PATCH] add SYSTEM_GTEST option to use gtest of the system This adds a new configure option forcing the system to use googletest installed on the system instead of downloading a version. The default is still to download googletest. --- test/tests/CMakeLists.txt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/tests/CMakeLists.txt b/test/tests/CMakeLists.txt index 1a4ad6aa03..00072fed81 100644 --- a/test/tests/CMakeLists.txt +++ b/test/tests/CMakeLists.txt @@ -1,6 +1,13 @@ cmake_minimum_required(VERSION 2.6) option(DISABLE_RCT2_TESTS "Disable tests that require RollerCoaster Tycoon 2 assets.") +option(SYSTEM_GTEST "Use the googletest library provided by the system.") + +if (SYSTEM_GTEST) + find_package(GTest REQUIRED) + + set(GTEST_LIBRARIES ${GTEST_BOTH_LIBRARIES}) +else (SYSTEM_GTEST) # Bootstrap GoogleTest INCLUDE(ExternalProject) @@ -52,12 +59,14 @@ set_property(TARGET ${GTEST_MAIN_LIBRARY} PROPERTY IMPORTED_LOCATION ${GTEST_MAI add_dependencies(${GTEST_LIBRARY} googletest) add_dependencies(${GTEST_MAIN_LIBRARY} ${GTEST_LIBRARY}) +set(GTEST_LIBRARIES gtest gtest_main pthread) + +endif (SYSTEM_GTEST) + include_directories(SYSTEM ${GTEST_INCLUDE_DIRS}) include_directories("${ROOT_DIR}/src") include_directories(${SDL2_INCLUDE_DIRS}) -set(GTEST_LIBRARIES gtest gtest_main pthread) - # Some most common files required in tests set(COMMON_TEST_SOURCES "${ROOT_DIR}/src/openrct2/core/Console.cpp"