]> the.earth.li Git - onak.git/commitdiff
Fix systemd detection
authorJonathan McDowell <noodles@earth.li>
Fri, 15 Sep 2023 05:50:54 +0000 (11:20 +0530)
committerJonathan McDowell <noodles@earth.li>
Fri, 15 Sep 2023 05:50:54 +0000 (11:20 +0530)
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
keydb/CMakeLists.txt

index 2355ebe1c8b682d358f15734adf0a9f899c51e29..e53ad465ca0687536b3264d762d969eee664c7d2 100644 (file)
@@ -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"
index 3d09dc4b065acb0ea9f60beb7bb1e6f7fe0ae9ed..7567b6c61efbad2570f2d7fdb8291ae85960d5f1 100644 (file)
@@ -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})