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