From 85e6e455ad25f9154411bf1354f99d56eddcc045 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Wed, 16 Jun 2021 15:39:31 +0200 Subject: data/CMakeLists.txt: Provide a hacky-whacky approach for finding the system unit dir for systemd less than 247. --- data/CMakeLists.txt | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'data') diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index 2949f15..875cb94 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -11,7 +11,25 @@ pkg_check_modules(SYSTEMD systemd) if (${SYSTEMD_FOUND}) if (${SYSTEMD_VERSION} VERSION_LESS 247) - set(SYSTEMD_USER_UNIT_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/systemd/user") + + # This bit now becomes really hacky-whacky... + + # As systemd is a build-requirement, there should be the + # systemd unit directory available on the build host, so + # let's look for that... + + if (EXISTS "/usr/lib/systemd/user") + # Let's try /usr/lib/ ... + set(SYSTEMD_USER_UNIT_DIR "/usr/lib/systemd/user") + elseif (EXISTS "/usr/lib64/systemd/user") + # Let's try /usr/lib64/ ... + set(SYSTEMD_USER_UNIT_DIR "/usr/lib64/systemd/user") + else() + # Fallback to something that fails on Debian and Ubuntu + # but might work on other distributions... + set(SYSTEMD_USER_UNIT_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/systemd/user") + endif() + else() pkg_get_variable(SYSTEMD_USER_UNIT_DIR systemd systemd_user_unit_dir) endif() -- cgit v1.2.3