Skip to content

Commit fa2f7dd

Browse files
peppapig450fufexan
authored andcommitted
cmake: fix systemd user unit install path
Installing to ${CMAKE_INSTALL_LIBDIR}/systemd/user can end up in /usr/lib64/systemd/user on multilib systems, which systemd does not search. Use pkg-config's systemduserunitdir instead (with a fallback to /usr/lib/systemd/user) so the unit is always installed in the correct location.
1 parent 1f9afca commit fa2f7dd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,10 @@ endif()
140140
include(GNUInstallDirs)
141141

142142
install(TARGETS hyprsunset)
143-
install(FILES ${CMAKE_BINARY_DIR}/systemd/hyprsunset.service DESTINATION ${CMAKE_INSTALL_LIBDIR}/systemd/user)
143+
144+
pkg_get_variable(SYSTEMD_USER_UNIT_DIR systemd systemduserunitdir)
145+
if (NOT SYSTEMD_USER_UNIT_DIR)
146+
set(SYSTEMD_USER_UNIT_DIR "${CMAKE_INSTALL_PREFIX}/lib/systemd/user")
147+
endif()
148+
149+
install(FILES ${CMAKE_BINARY_DIR}/systemd/hyprsunset.service DESTINATION "${SYSTEMD_USER_UNIT_DIR}")

0 commit comments

Comments
 (0)