From 3b090f49a5df1b3cef6a635924b782e8ee93b419 Mon Sep 17 00:00:00 2001 From: Thijs Paelman Date: Mon, 9 Jun 2025 13:35:21 +0200 Subject: build: Always install systemd service when asked When the variable SYSTEMD_UNITDIR is specified (for example on the command line), always install the systemd service file to this directory, even if systemd is not found by pkg-config. This also will help building with Guix without patching CMakeLists.txt. Signed-off-by: Thijs Paelman Signed-off-by: Sander Vrijders --- CMakeLists.txt | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e3c7976c..c69b89b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -141,18 +141,18 @@ if (SYSTEMD_FOUND) "${SYSTEMD_UNITDIR}" ) endif () - if (NOT ${SYSTEMD_UNITDIR} STREQUAL "") - message(STATUS "Installing systemd service in: ${SYSTEMD_UNITDIR}") - if (LIBTOML_LIBRARIES AND NOT DISABLE_CONFIGFILE) - set (CONFIGURE_STRING "--config ${OUROBOROS_CONFIG_DIR}${OUROBOROS_CONFIG_FILE}") - else () - set (CONFIGURE_STRING "") - endif () - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ouroboros.service.in" - "${CMAKE_CURRENT_BINARY_DIR}/ouroboros.service" @ONLY) - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ouroboros.service" - DESTINATION "${SYSTEMD_UNITDIR}") +endif () +if (NOT ${SYSTEMD_UNITDIR} STREQUAL "") + message(STATUS "Installing systemd service in: ${SYSTEMD_UNITDIR}") + if (LIBTOML_LIBRARIES AND NOT DISABLE_CONFIGFILE) + set (CONFIGURE_STRING "--config ${OUROBOROS_CONFIG_DIR}${OUROBOROS_CONFIG_FILE}") + else () + set (CONFIGURE_STRING "") endif () + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ouroboros.service.in" + "${CMAKE_CURRENT_BINARY_DIR}/ouroboros.service" @ONLY) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ouroboros.service" + DESTINATION "${SYSTEMD_UNITDIR}") endif () enable_testing() -- cgit v1.2.3