summaryrefslogtreecommitdiff
path: root/test/interactive-helper
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2022-04-21 01:45:45 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2022-05-07 10:45:44 +0200
commit8d8b45a96ceceb015f7836cf25b99279c2f377b9 (patch)
tree93a497556cdfac9332afbeeffdaf9f8a0485e9b2 /test/interactive-helper
parentee06eb541e5aa477880ff0fc575be317eccbd929 (diff)
Link interactive helpers against system libapt for autopkgtest
Building the library just so we can build the helpers against it is not only wasteful but as we are supposed to test the system we can use that as an additional simple smoke test before the real testing starts.
Diffstat (limited to 'test/interactive-helper')
-rw-r--r--test/interactive-helper/CMakeLists.txt27
1 files changed, 20 insertions, 7 deletions
diff --git a/test/interactive-helper/CMakeLists.txt b/test/interactive-helper/CMakeLists.txt
index fff47300b..8e8764353 100644
--- a/test/interactive-helper/CMakeLists.txt
+++ b/test/interactive-helper/CMakeLists.txt
@@ -1,18 +1,31 @@
+if(USE_SYSTEM_APTPKG)
+ find_library(aptpkg NAMES apt-pkg NO_PACKAGE_ROOT_PATH REQUIRED)
+ set(APTPKG_LIB "${aptpkg}")
+ # it isn't easy to link against -private, but that is by design
+ set(APTPRIVATE_LIB "/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/libapt-private.so.0.0")
+ set(APTPRIVATE_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}")
+else()
+ set(APTPKG_LIB "apt-pkg")
+ set(APTPRIVATE_LIB "apt-private")
+ set(APTPRIVATE_INCLUDE_DIRS "")
+endif()
+
add_executable(mthdcat mthdcat.cc)
-target_link_libraries(mthdcat apt-pkg)
+target_link_libraries(mthdcat ${APTPKG_LIB})
add_executable(testdeb testdeb.cc)
-target_link_libraries(testdeb apt-pkg)
+target_link_libraries(testdeb ${APTPKG_LIB})
add_executable(extract-control extract-control.cc)
-target_link_libraries(extract-control apt-pkg)
+target_link_libraries(extract-control ${APTPKG_LIB})
add_executable(aptwebserver aptwebserver.cc)
-target_link_libraries(aptwebserver apt-pkg ${CMAKE_THREAD_LIBS_INIT})
+target_link_libraries(aptwebserver ${APTPKG_LIB} ${CMAKE_THREAD_LIBS_INIT})
add_executable(aptdropprivs aptdropprivs.cc)
-target_link_libraries(aptdropprivs apt-pkg)
+target_link_libraries(aptdropprivs ${APTPKG_LIB})
add_executable(test_fileutl test_fileutl.cc)
-target_link_libraries(test_fileutl apt-pkg)
+target_link_libraries(test_fileutl ${APTPKG_LIB})
add_executable(createdeb-cve-2020-27350 createdeb-cve-2020-27350.cc)
add_executable(longest-dependency-chain longest-dependency-chain.cc)
-target_link_libraries(longest-dependency-chain apt-pkg apt-private)
+target_link_libraries(longest-dependency-chain ${APTPKG_LIB} ${APTPRIVATE_LIB})
+target_include_directories(longest-dependency-chain PRIVATE ${APTPRIVATE_INCLUDE_DIRS})
add_library(noprofile SHARED libnoprofile.c)
target_link_libraries(noprofile ${CMAKE_DL_LIBS})