aboutsummaryrefslogtreecommitdiff
path: root/data/CMakeLists.txt
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-10-07 21:35:14 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-10-07 21:38:05 +0200
commitdac8f7743bd16fb6dda3d29bf717f636fb4b8488 (patch)
treee22d178853e370dc859decf5133d10a9cac7c485 /data/CMakeLists.txt
parentefdc686369ca36ab2415c4362e6c3a70de71c084 (diff)
downloadayatana-indicator-power-dac8f7743bd16fb6dda3d29bf717f636fb4b8488.tar.gz
ayatana-indicator-power-dac8f7743bd16fb6dda3d29bf717f636fb4b8488.tar.bz2
ayatana-indicator-power-dac8f7743bd16fb6dda3d29bf717f636fb4b8488.zip
systemd unit file: Only build+install if systemd is available at build-time.
Diffstat (limited to 'data/CMakeLists.txt')
-rw-r--r--data/CMakeLists.txt42
1 files changed, 21 insertions, 21 deletions
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
index dc5b69f..3da3d99 100644
--- a/data/CMakeLists.txt
+++ b/data/CMakeLists.txt
@@ -18,33 +18,33 @@ add_schema (${SCHEMA_FILE})
## Systemd Unit File
##
-# where to install
-# Uncomment when we drop Vivid
-# pkg_get_variable(SYSTEMD_USER_DIR systemd systemduserunitdir)
-set (SYSTEMD_USER_DIR "/usr/lib/systemd/user")
-message (STATUS "${SYSTEMD_USER_DIR} is the systemd user unit file install dir")
+pkg_check_modules(SYSTEMD systemd)
+if (${SYSTEMD_FOUND})
+ pkg_get_variable(SYSTEMD_USER_DIR systemd systemduserunitdir)
+ message (STATUS "${SYSTEMD_USER_DIR} is the systemd user unit file install dir")
-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")
+ 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")
-# build it
-set (pkglibexecdir "${CMAKE_INSTALL_FULL_PKGLIBEXECDIR}")
-configure_file ("${SYSTEMD_USER_FILE_IN}" "${SYSTEMD_USER_FILE}")
+ # build it
+ set (pkglibexecdir "${CMAKE_INSTALL_FULL_PKGLIBEXECDIR}")
+ configure_file ("${SYSTEMD_USER_FILE_IN}" "${SYSTEMD_USER_FILE}")
-# install it
-install (FILES "${SYSTEMD_USER_FILE}"
- DESTINATION "${SYSTEMD_USER_DIR}")
+ # install it
+ install (FILES "${SYSTEMD_USER_FILE}"
+ DESTINATION "${SYSTEMD_USER_DIR}")
-##
-## Upstart systemd override Job File
-##
+ ##
+ ## Upstart systemd override Job File
+ ##
-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")
+ 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}")
+ install (FILES "${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_PROJECT_NAME}.override"
+ DESTINATION "${UPSTART_SYSTEMD_OVERRIDE_DIR}")
+endif()
##
## Upstart Job File