--- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -55,10 +55,7 @@ set(LIT_ARGS -s CACHE STRING "Arguments to pass to lit") # the location of GTest source code is probably error prone so using a copy in the # repository seems like the easiest thing to do. This also has the added benefit that # everyone uses the same version of GTest. -set(GTEST_PREFIX ${PROJECT_SOURCE_DIR}/deps/gtest) -if (NOT EXISTS "${GTEST_PREFIX}/CMakeLists.txt") - message(FATAL_ERROR "Could not find GTest. Did you run scripts/deps/setup-gtest.sh?") -endif() +find_package(GTest REQUIRED) if (MSVC) # STP is built with the shared version of the CRT, gtest defaults to the @@ -68,11 +65,8 @@ endif() set(PREV_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format-nonliteral -Wno-missing-field-initializers") -add_subdirectory(${GTEST_PREFIX} gtest) set(CMAKE_CXX_FLAGS "${PREV_CMAKE_CXX_FLAGS}") -set(GTEST_BOTH_LIBRARIES gtest gtest_main) -include_directories(${GTEST_PREFIX}/include) # Add handy macros/functions include(AddSTPGTest)