summaryrefslogtreecommitdiffstats
path: root/systemd
diff options
context:
space:
mode:
author胡玮文 <huww98@outlook.com>2021-04-14 19:33:18 +0200
committer胡玮文 <huww98@outlook.com>2021-11-18 08:07:26 +0100
commit8e49d3617012a70f037b506c99ddd0debd53a3e8 (patch)
tree3ff836019186f6e48287d94fca9758991676fd1e /systemd
parentMerge PR #43929 into master (diff)
downloadceph-8e49d3617012a70f037b506c99ddd0debd53a3e8.tar.xz
ceph-8e49d3617012a70f037b506c99ddd0debd53a3e8.zip
cmake: fix default systemd unit install dir
The original usage of CMAKE_INSTALL_LIBEXECDIR is incorrect. Also try to get the path from pkg-config Signed-off-by: 胡玮文 <huww98@outlook.com>
Diffstat (limited to 'systemd')
-rw-r--r--systemd/CMakeLists.txt17
1 files changed, 13 insertions, 4 deletions
diff --git a/systemd/CMakeLists.txt b/systemd/CMakeLists.txt
index 499b5d19024..ad75ce61cd8 100644
--- a/systemd/CMakeLists.txt
+++ b/systemd/CMakeLists.txt
@@ -1,5 +1,14 @@
-set(CMAKE_INSTALL_SYSTEMD_SERVICEDIR "${CMAKE_INSTALL_LIBEXECDIR}/systemd/system"
- CACHE PATH "Location for systemd service files")
+find_package(PkgConfig QUIET REQUIRED)
+pkg_get_variable(SYSTEMD_SYSTEM_UNIT_DIR "systemd" "systemd_system_unit_dir")
+if(NOT SYSTEMD_SYSTEM_UNIT_DIR)
+ pkg_get_variable(SYSTEMD_SYSTEM_UNIT_DIR "systemd" "systemdsystemunitdir")
+ if(NOT SYSTEMD_SYSTEM_UNIT_DIR)
+ set(SYSTEMD_SYSTEM_UNIT_DIR "${CMAKE_INSTALL_LIBDIR}/systemd/system")
+ endif()
+endif()
+set(SYSTEMD_SYSTEM_UNIT_DIR "${SYSTEMD_SYSTEM_UNIT_DIR}"
+ CACHE PATH "Location for systemd system unit files")
+
set(CEPH_SYSTEMD_ENV_DIR "/etc/sysconfig"
CACHE PATH "Location for systemd service environmental variable settings files")
set(SYSTEMD_ENV_FILE "${CEPH_SYSTEMD_ENV_DIR}/ceph")
@@ -21,7 +30,7 @@ foreach(service
@ONLY)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/${service}.service
- DESTINATION ${CMAKE_INSTALL_SYSTEMD_SERVICEDIR})
+ DESTINATION ${SYSTEMD_SYSTEM_UNIT_DIR})
endforeach()
install(FILES
@@ -36,4 +45,4 @@ install(FILES
ceph-immutable-object-cache.target
ceph-volume@.service
cephfs-mirror.target
- DESTINATION ${CMAKE_INSTALL_SYSTEMD_SERVICEDIR})
+ DESTINATION ${SYSTEMD_SYSTEM_UNIT_DIR})