1 include(ExternalProject)
3 set(GTEST_ROOT "/usr/src/gtest" CACHE FILEPATH "Path to GTest CMake project")
5 message(STATUS "Found GTest at ${GTEST_ROOT}")
7 if (EXISTS ${GTEST_ROOT})
9 ExternalProject_Add(gtest PREFIX ./gtest
10 SOURCE_DIR ${GTEST_ROOT}
13 link_directories(${CMAKE_CURRENT_BINARY_DIR}/gtest/src/gtest-build)
14 FILE(GLOB files gtest_runner.cc *-helpers.cc *_test.cc)
15 add_executable(libapt_test ${files})
16 target_link_libraries(libapt_test -lgtest ${CMAKE_THREAD_LIBS_INIT} apt-private apt-inst)
17 add_dependencies(libapt_test gtest)
18 add_test(NAME AptTests
20 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})