From 71e997a223f3fa7f4493403557073994a395d6bc Mon Sep 17 00:00:00 2001
From: Marius <mariogrip@debian.org>
Date: Sat, 15 Nov 2025 15:56:03 +0100
Subject: [PATCH] Allow to build on system without systemd

---
 extras/CMakeLists.txt | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/extras/CMakeLists.txt b/extras/CMakeLists.txt
index 9339635..59b83cf 100644
--- a/extras/CMakeLists.txt
+++ b/extras/CMakeLists.txt
@@ -13,7 +13,11 @@ configure_file(
     @ONLY
 )
 pkg_get_variable(SYSTEMD_SYSTEM_UNIT_DIR systemd systemdsystemunitdir)
-install(
-    FILES "${CMAKE_CURRENT_BINARY_DIR}/update-machine-info-from-deviceinfo.service"
-    DESTINATION ${SYSTEMD_SYSTEM_UNIT_DIR}
-)
+if(SYSTEMD_SYSTEM_UNIT_DIR)
+    install(
+        FILES "${CMAKE_CURRENT_BINARY_DIR}/update-machine-info-from-deviceinfo.service"
+        DESTINATION ${SYSTEMD_SYSTEM_UNIT_DIR}
+    )
+else()
+    message(WARNING "Could not find systemd target folder, not install systemd service file")
+endif()
-- 
2.43.0

