summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2018-06-28 18:23:36 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2018-08-14 19:44:28 +0200
commit9a521ed76019fc7bdad1bf09c063bd3550536ef0 (patch)
treeed9a184172100154b3a262ddd2c6bb55f68b5ee4
parent55489885b51b02b7f74e601a393ecaefd1f71f9c (diff)
CMake: Use ${PROJECT_NAME} instead of hardcoding apt
Completely pointless as it makes no difference for apt, but copying the file to other projects becomes a lot easier. Gbp-Dch: Ignore
-rw-r--r--test/libapt/CMakeLists.txt13
1 files changed, 7 insertions, 6 deletions
diff --git a/test/libapt/CMakeLists.txt b/test/libapt/CMakeLists.txt
index cc1d024f8..035ff07b1 100644
--- a/test/libapt/CMakeLists.txt
+++ b/test/libapt/CMakeLists.txt
@@ -1,3 +1,4 @@
+set(PROJECT_TEST_LIBRARIES apt-private apt-inst)
find_path(GTEST_ROOT src/gtest.cc
/usr/src/googletest/googletest
/usr/src/gtest
@@ -31,13 +32,13 @@ if(GTEST_FOUND)
# is expanded at CMake time, so you have to rerun cmake if you add or remove
# a file (you can just run cmake . in the build directory)
file(GLOB files gtest_runner.cc *-helpers.cc *_test.cc)
- add_executable(libapt_test ${files})
- target_include_directories(libapt_test PRIVATE ${GTEST_INCLUDE_DIRS})
- target_link_libraries(libapt_test ${GTEST_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} apt-private apt-inst)
+ add_executable(lib${PROJECT_NAME}_test ${files})
+ target_include_directories(lib${PROJECT_NAME}_test PRIVATE ${GTEST_INCLUDE_DIRS})
+ target_link_libraries(lib${PROJECT_NAME}_test ${GTEST_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${PROJECT_TEST_LIBRARIES})
if (GTEST_DEPENDENCIES)
- add_dependencies(libapt_test ${GTEST_DEPENDENCIES})
+ add_dependencies(lib${PROJECT_NAME}_test ${GTEST_DEPENDENCIES})
endif()
- add_test(NAME AptTests
- COMMAND libapt_test
+ add_test(NAME ${PROJECT_NAME}Tests
+ COMMAND lib${PROJECT_NAME}_test
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endif()