diff options
author | Ralf Habacker <ralf.habacker@freenet.de> | 2020-05-18 12:47:51 +0200 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2020-06-10 18:13:47 +0000 |
commit | 927a5f4d757e9eacb6f133ebd45b69db01e9e2f3 (patch) | |
tree | 7b022f56b45be246fc4e6333322134f082d2a39b /CMakeLists.txt | |
parent | 97bdefd4e2598e6ea72337acb4230928594bda81 (diff) | |
download | dbus-927a5f4d757e9eacb6f133ebd45b69db01e9e2f3.tar.gz |
cmake: add support for user session semantic on Linux operating systems
Systemd user support is controlled by the cmake variable ENABLE_USER_SESSION,
which and WITH_SYSTEMD_USERUNITDIR to specify a custom installation
location. If WITH_SYSTEMD_USERUNITDIR is not specified, the related install
path is determined from an installed systemd package, if present.
This was added to the Autotools build system as part of fd.o#61301,
but until now was not possible to enable when building with CMake.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 48cf9675..caef7384 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -151,7 +151,11 @@ if(DBUS_LINUX) set(DBUS_BUS_ENABLE_SYSTEMD ON) set(HAVE_SYSTEMD ${SYSTEMD_FOUND}) endif() + option(ENABLE_USER_SESSION "enable user-session semantics for session bus under systemd" OFF) + set(DBUS_ENABLE_USER_SESSION ${ENABLE_USER_SESSION}) + add_path_option(WITH_SYSTEMD_SYSTEMUNITDIR "Directory for systemd service files" "") + add_path_option(WITH_SYSTEMD_USERUNITDIR "Directory for systemd user service files" "") # get defaults pkg_check_modules(_SYSTEMD systemd) if(_SYSTEMD_FOUND) @@ -160,12 +164,17 @@ if(DBUS_LINUX) pkg_get_variable(_SYSTEMD_USERUNITDIR systemd systemduserunitdir) # remove install prefix, which may not match the current prefix string(REPLACE "${_SYSTEMD_PREFIX}/" "" DBUS_SYSTEMD_SYSTEMUNITDIR ${_SYSTEMD_SYSTEMUNITDIR}) + string(REPLACE "${_SYSTEMD_PREFIX}/" "" DBUS_SYSTEMD_USERUNITDIR ${_SYSTEMD_USERUNITDIR}) else() set(DBUS_SYSTEMD_SYSTEMUNITDIR lib/systemd/system) + set(DBUS_SYSTEMD_USERUNITDIR lib/systemd/user) endif() if(WITH_SYSTEMD_SYSTEMUNITDIR) set(DBUS_SYSTEMD_SYSTEMUNITDIR ${WITH_SYSTEMD_SYSTEMUNITDIR}) endif() + if(WITH_SYSTEMD_USERUNITDIR) + set(DBUS_SYSTEMD_USERUNITDIR ${WITH_SYSTEMD_USERUNITDIR}) + endif() endif() if(WIN32) @@ -644,6 +653,7 @@ message(" Building inotify support: ${DBUS_BUS_ENABLE_INOTIFY} " message(" Building kqueue support: ${DBUS_BUS_ENABLE_KQUEUE} ") message(" Building systemd support: ${DBUS_BUS_ENABLE_SYSTEMD} ") message(" systemd system install dir:${DBUS_SYSTEMD_SYSTEMUNITDIR} ") +message(" systemd user install dir: ${DBUS_SYSTEMD_USERUNITDIR} ") message(" Building Doxygen docs: ${DBUS_ENABLE_DOXYGEN_DOCS} ") message(" Building Qt help docs: ${DBUS_ENABLE_QTHELP_DOCS} ") message(" Building XML docs: ${DBUS_ENABLE_XML_DOCS} ") |