From a8f2e191cb35193cb49aca5a6ccdac2170c334a1 Mon Sep 17 00:00:00 2001 From: Jonathan McDowell Date: Fri, 15 Sep 2023 11:20:54 +0530 Subject: [PATCH] Fix systemd detection All of our systemd detection logic was in keydb/CMakeLists.txt because only keyd actually cares about it. However that then means we don't correctly update build-config.h with HAVE_SYSTEMD and so we link against it, but don't correctly do socket activation. Split out the detection into the main CMakeLists.txt so we correctly set the define. --- CMakeLists.txt | 6 ++++++ keydb/CMakeLists.txt | 2 -- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2355ebe..e53ad46 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -93,6 +93,12 @@ if (GMP_FOUND) CHECK_SYMBOL_EXISTS(nettle_get_secp_521r1 "nettle/ecc-curve.h" HAVE_NETTLE_GET_SECP_521R1) endif() +# keyd will use this for socket activation, if it's available +pkg_check_modules(SYSTEMD libsystemd) +if (SYSTEMD_FOUND) + set(HAVE_SYSTEMD true) +endif() + # Build files that have substitutions in them include_directories(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}) configure_file("${CMAKE_SOURCE_DIR}/build-config.h.in" diff --git a/keydb/CMakeLists.txt b/keydb/CMakeLists.txt index 3d09dc4..7567b6c 100644 --- a/keydb/CMakeLists.txt +++ b/keydb/CMakeLists.txt @@ -37,9 +37,7 @@ if (KEYD STREQUAL "ON") target_compile_definitions(keydctl PRIVATE CONFIGDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}") - pkg_check_modules(SYSTEMD libsystemd) if (SYSTEMD_FOUND) - set(HAVE_SYSTEMD true) target_include_directories(keyd SYSTEM PUBLIC ${SYSTEMD_INCLUDE_DIRS}) target_link_libraries(keyd ${SYSTEMD_LIBRARIES}) -- 2.39.5