]> git.saurik.com Git - apt.git/blame - test/libapt/CMakeLists.txt
abort connection on '.' target replies in SRV
[apt.git] / test / libapt / CMakeLists.txt
CommitLineData
06c2b40b
JAK
1set(GTEST_ROOT "/usr/src/gtest" CACHE FILEPATH "Path to GTest CMake project")
2
99ba7cc1
JAK
3find_package(GTest)
4set(GTEST_DEPENDENCIES)
5
6if(NOT GTEST_FOUND AND EXISTS ${GTEST_ROOT})
7 include(ExternalProject)
8 ExternalProject_Add(gtest PREFIX ./gtest
9 SOURCE_DIR ${GTEST_ROOT}
10 INSTALL_COMMAND true)
06c2b40b 11
99ba7cc1 12 link_directories(${CMAKE_CURRENT_BINARY_DIR}/gtest/src/gtest-build)
06c2b40b 13
99ba7cc1
JAK
14 set(GTEST_LIBRARIES "-lgtest")
15 set(GTEST_DEPENDENCIES "gtest")
16 set(GTEST_FOUND TRUE)
17 find_path(GTEST_INCLUDE_DIRS NAMES gtest/gtest.h)
06c2b40b 18
99ba7cc1
JAK
19 message(STATUS "Found GTest at ${GTEST_ROOT}, headers at ${GTEST_INCLUDE_DIRS}")
20endif()
06c2b40b 21
99ba7cc1
JAK
22if(GTEST_FOUND)
23 file(GLOB files gtest_runner.cc *-helpers.cc *_test.cc)
24 add_executable(libapt_test ${files})
25 target_include_directories(libapt_test PRIVATE ${GTEST_INCLUDE_DIRS})
26 target_link_libraries(libapt_test ${GTEST_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} apt-private apt-inst)
27 if (GTEST_DEPENDENCIES)
28 add_dependencies(libapt_test ${GTEST_DEPENDENCIES})
29 endif()
30 add_test(NAME AptTests
31 COMMAND libapt_test
32 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
06c2b40b 33endif()