aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-10-23 20:21:42 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-10-23 20:21:42 +0200
commit931fa6e67a071caee173e00110c42112c16f638c (patch)
treef53eb49c0d5175ccf91a3f1c275ec7012f07cc57
parentcbf058fc662d2d2898095b28ed364b7f22b8f911 (diff)
downloadayatana-indicator-sound-931fa6e67a071caee173e00110c42112c16f638c.tar.gz
ayatana-indicator-sound-931fa6e67a071caee173e00110c42112c16f638c.tar.bz2
ayatana-indicator-sound-931fa6e67a071caee173e00110c42112c16f638c.zip
systemd unit file: Only build+install if systemd is available at build-time.
-rw-r--r--data/CMakeLists.txt42
1 files changed, 23 insertions, 19 deletions
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
index 777b8cd..69a5095 100644
--- a/data/CMakeLists.txt
+++ b/data/CMakeLists.txt
@@ -20,31 +20,35 @@ install(
# Systemd Job
###########################
-# where to install
-pkg_get_variable(SYSTEMD_USER_DIR systemd systemduserunitdir)
-message (STATUS "${SYSTEMD_USER_DIR} is the systemd user unit file install dir")
+pkg_check_modules(SYSTEMD systemd)
+if (${SYSTEMD_FOUND})
-set (SYSTEMD_USER_NAME "${CMAKE_PROJECT_NAME}.service")
-set (SYSTEMD_USER_FILE "${CMAKE_CURRENT_BINARY_DIR}/${SYSTEMD_USER_NAME}")
-set (SYSTEMD_USER_FILE_IN "${CMAKE_CURRENT_SOURCE_DIR}/${SYSTEMD_USER_NAME}.in")
+ # where to install
+ pkg_get_variable(SYSTEMD_USER_DIR systemd systemduserunitdir)
+ message (STATUS "${SYSTEMD_USER_DIR} is the systemd user unit file install dir")
-# build it
-set (pkglibexecdir "${CMAKE_INSTALL_FULL_PKGLIBEXECDIR}")
-configure_file ("${SYSTEMD_USER_FILE_IN}" "${SYSTEMD_USER_FILE}")
+ set (SYSTEMD_USER_NAME "${CMAKE_PROJECT_NAME}.service")
+ set (SYSTEMD_USER_FILE "${CMAKE_CURRENT_BINARY_DIR}/${SYSTEMD_USER_NAME}")
+ set (SYSTEMD_USER_FILE_IN "${CMAKE_CURRENT_SOURCE_DIR}/${SYSTEMD_USER_NAME}.in")
-# install it
-install (FILES "${SYSTEMD_USER_FILE}"
- DESTINATION "${SYSTEMD_USER_DIR}")
+ # build it
+ set (pkglibexecdir "${CMAKE_INSTALL_FULL_PKGLIBEXECDIR}")
+ configure_file ("${SYSTEMD_USER_FILE_IN}" "${SYSTEMD_USER_FILE}")
-###########################
-# Upstart systemd override Job File
-###########################
+ # install it
+ install (FILES "${SYSTEMD_USER_FILE}"
+ DESTINATION "${SYSTEMD_USER_DIR}")
-set (UPSTART_SYSTEMD_OVERRIDE_DIR "${CMAKE_INSTALL_FULL_DATADIR}/upstart/systemd-session/upstart")
-message (STATUS "${UPSTART_SYSTEMD_OVERRIDE_DIR} is the Upstart override Job File for systemd dir")
+ ###########################
+ # Upstart systemd override Job File
+ ###########################
-install (FILES "${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_PROJECT_NAME}.override"
- DESTINATION "${UPSTART_SYSTEMD_OVERRIDE_DIR}")
+ set (UPSTART_SYSTEMD_OVERRIDE_DIR "${CMAKE_INSTALL_FULL_DATADIR}/upstart/systemd-session/upstart")
+ message (STATUS "${UPSTART_SYSTEMD_OVERRIDE_DIR} is the Upstart override Job File for systemd dir")
+
+ install (FILES "${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_PROJECT_NAME}.override"
+ DESTINATION "${UPSTART_SYSTEMD_OVERRIDE_DIR}")
+endif()
###########################
# Upstart Job