From 9a521ed76019fc7bdad1bf09c063bd3550536ef0 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 28 Jun 2018 18:23:36 +0200 Subject: 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 --- test/libapt/CMakeLists.txt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'test/libapt') 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() -- cgit v1.2.3