summaryrefslogtreecommitdiff
blob: 2c1392b731fc9af147fe20dae82589f3ca41b611 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
--- a/test/tests/CMakeLists.txt	2017-07-13 14:46:34.690292993 +0200
+++ b/test/tests/CMakeLists.txt	2017-07-13 14:56:57.678054368 +0200
@@ -2,61 +2,13 @@
 
 option(DISABLE_RCT2_TESTS "Disable tests that require RollerCoaster Tycoon 2 assets.")
 
-# Bootstrap GoogleTest
-INCLUDE(ExternalProject)
+find_package(GTest REQUIRED)
 
-ExternalProject_Add(
-        googletest-distribution
-        URL https://github.com/google/googletest/archive/release-1.8.0.tar.gz
-        URL_HASH SHA1=e7e646a6204638fe8e87e165292b8dd9cd4c36ed
-        TIMEOUT 10
-        CONFIGURE_COMMAND ""
-        BUILD_COMMAND ""
-        INSTALL_COMMAND ""
-)
-
-# Specify include dir
-ExternalProject_Get_Property(googletest-distribution SOURCE_DIR)
-set(GOOGLETEST_DISTRIB_SOURCE_DIR "${SOURCE_DIR}")
-
-ExternalProject_Add(
-        googletest
-        DEPENDS googletest-distribution
-        DOWNLOAD_COMMAND ""
-        SOURCE_DIR "${GOOGLETEST_DISTRIB_SOURCE_DIR}/googletest"
-        CMAKE_ARGS "-DCMAKE_CXX_FLAGS=${TARGET_M}"
-        BUILD_BYPRODUCTS "googletest-prefix/src/googletest-build/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}"
-        BUILD_BYPRODUCTS "googletest-prefix/src/googletest-build/${CMAKE_STATIC_LIBRARY_PREFIX}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX}"
-        # Disable install step
-        INSTALL_COMMAND ""
-        # Wrap download, configure and build steps in a script to log output
-        LOG_DOWNLOAD ON
-        LOG_CONFIGURE ON
-        LOG_BUILD ON)
-
-
-# Specify include dir
-set(GTEST_INCLUDE_DIR ${GOOGLETEST_DISTRIB_SOURCE_DIR}/googletest/include)
-
-# Library
-ExternalProject_Get_Property(googletest BINARY_DIR)
-set(GOOGLETEST_BINARY_DIR "${BINARY_DIR}")
-set(GTEST_LIBRARY_PATH ${GOOGLETEST_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX})
-set(GTEST_MAIN_LIBRARY_PATH ${GOOGLETEST_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX})
-set(GTEST_LIBRARY gtest)
-set(GTEST_MAIN_LIBRARY gtest_main)
-add_library(${GTEST_LIBRARY} STATIC IMPORTED)
-add_library(${GTEST_MAIN_LIBRARY} STATIC IMPORTED)
-set_property(TARGET ${GTEST_LIBRARY} PROPERTY IMPORTED_LOCATION ${GTEST_LIBRARY_PATH})
-set_property(TARGET ${GTEST_MAIN_LIBRARY} PROPERTY IMPORTED_LOCATION ${GTEST_MAIN_LIBRARY_PATH})
-add_dependencies(${GTEST_LIBRARY} googletest)
-add_dependencies(${GTEST_MAIN_LIBRARY} ${GTEST_LIBRARY})
-
-include_directories(SYSTEM ${GTEST_INCLUDE_DIR})
+include_directories(SYSTEM ${GTEST_INCLUDE_DIRS})
 include_directories("${ROOT_DIR}/src")
 include_directories(${SDL2_INCLUDE_DIRS})
 
-set(GTEST_LIBRARIES gtest gtest_main pthread)
+set(GTEST_LIBRARIES ${GTEST_BOTH_LIBRARIES})
 
 # Some most common files required in tests
 set(COMMON_TEST_SOURCES