Commit f52d335d authored by Leo's avatar Leo
Browse files

Try to get systemd user unit dir from pkgconfig

if we can't get it then fallback on a sane-ish default of
'lib/system/user'
parent e55caee1
......@@ -16,6 +16,7 @@ include(${CPM_DOWNLOAD_LOCATION})
# Include GNU install directory module to detect where to install
# files on Linux/Unix systems (e.g., lib vs lib64)
include(GNUInstallDirs)
find_package(PkgConfig)
CPMAddPackage(
NAME IODash
......@@ -42,6 +43,15 @@ CPMAddPackage(
GIT_TAG 2d8e17c4f88efce80e274cb03eeb902e055a91d3
)
# Try to get the systemd directory for user units from the package
# and fall back on upstream default without the '/usr' prefix
pkg_check_modules(SYSTEMD systemd)
if (SYSTEMD_FOUND)
pkg_get_variable(SD_UNITDIR systemd systemduserunitdir)
else()
set(SD_UNITDIR "lib/systemd/user")
endif()
set(SOURCE_FILES_LIBRARY
CommonIncludes.hpp
Library/Tool.hpp Library/Tool.cpp
......
......@@ -2,4 +2,4 @@ configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/ydotool.service.in"
"${PROJECT_BINARY_DIR}/ydotool.service"
@ONLY)
install(FILES "${PROJECT_BINARY_DIR}/ydotool.service" DESTINATION /usr/lib/systemd/user/)
install(FILES "${PROJECT_BINARY_DIR}/ydotool.service" DESTINATION ${SD_UNITDIR})
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment