]>
Commit | Line | Data |
---|---|---|
06c2b40b JAK |
1 | include(ExternalProject) |
2 | ||
3 | set(GTEST_ROOT "/usr/src/gtest" CACHE FILEPATH "Path to GTest CMake project") | |
4 | ||
5 | message(STATUS "Found GTest at ${GTEST_ROOT}") | |
6 | ||
7 | if (EXISTS ${GTEST_ROOT}) | |
8 | ||
9 | ExternalProject_Add(gtest PREFIX ./gtest | |
10 | SOURCE_DIR ${GTEST_ROOT} | |
11 | INSTALL_COMMAND true) | |
12 | ||
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 | |
19 | COMMAND libapt_test | |
20 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) | |
21 | ||
22 | endif() |