1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 19:13:07 +01:00

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.
This commit is contained in:
Hendrik v. Raven
2017-07-26 10:50:00 +02:00
committed by Michał Janiszewski
parent cfa20d2117
commit 0f111de224

View File

@@ -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"