summaryrefslogtreecommitdiff
path: root/test/libapt/CMakeLists.txt
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2016-08-10 16:19:00 +0200
committerJulian Andres Klode <jak@debian.org>2016-08-10 16:19:00 +0200
commite02c3a9ec2b2f7a8d4aecd70f2ecdae27c207aa9 (patch)
treeffa99f96949f3eab728a1b8caecdd014ea8d6f81 /test/libapt/CMakeLists.txt
parentb2cfacf1180e4b3fcbb2ae2ea52cf270ef74e971 (diff)
parent61fef4ddbec8f70bb9e213ac0491d4e6cfefab30 (diff)
Merge branch 'cmake'
Diffstat (limited to 'test/libapt/CMakeLists.txt')
-rw-r--r--test/libapt/CMakeLists.txt22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/libapt/CMakeLists.txt b/test/libapt/CMakeLists.txt
new file mode 100644
index 000000000..7f9990526
--- /dev/null
+++ b/test/libapt/CMakeLists.txt
@@ -0,0 +1,22 @@
+include(ExternalProject)
+
+set(GTEST_ROOT "/usr/src/gtest" CACHE FILEPATH "Path to GTest CMake project")
+
+message(STATUS "Found GTest at ${GTEST_ROOT}")
+
+if (EXISTS ${GTEST_ROOT})
+
+ExternalProject_Add(gtest PREFIX ./gtest
+ SOURCE_DIR ${GTEST_ROOT}
+ INSTALL_COMMAND true)
+
+link_directories(${CMAKE_CURRENT_BINARY_DIR}/gtest/src/gtest-build)
+FILE(GLOB files gtest_runner.cc *-helpers.cc *_test.cc)
+add_executable(libapt_test ${files})
+target_link_libraries(libapt_test -lgtest ${CMAKE_THREAD_LIBS_INIT} apt-private apt-inst)
+add_dependencies(libapt_test gtest)
+add_test(NAME AptTests
+ COMMAND libapt_test
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+
+endif()