diff options
author | David Faure <faure@kde.org> | 2012-09-04 21:12:57 +0200 |
---|---|---|
committer | David Faure <faure@kde.org> | 2012-09-04 21:12:57 +0200 |
commit | 86f8d568869c6780576a303b14a68c29870b4e47 (patch) | |
tree | ccf062f61e2f3f3eb8c0809e56e9d1d4f0a25fda /modules/MacroDBusAddActivationService.cmake | |
parent | 4d7af308b0cf8dcdc36b18a3c17310e1e16c0563 (diff) | |
download | extra-cmake-modules-86f8d568869c6780576a303b14a68c29870b4e47.tar.gz extra-cmake-modules-86f8d568869c6780576a303b14a68c29870b4e47.tar.bz2 |
Add the macro dbus_add_activation_service to ECM.
Wrote full docu for it, and then aseigo pointed me to a wiki page
that had it all already...
http://techbase.kde.org/Development/Tutorials/D-Bus/Autostart_Services
Diffstat (limited to 'modules/MacroDBusAddActivationService.cmake')
-rw-r--r-- | modules/MacroDBusAddActivationService.cmake | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/modules/MacroDBusAddActivationService.cmake b/modules/MacroDBusAddActivationService.cmake new file mode 100644 index 00000000..d31dab74 --- /dev/null +++ b/modules/MacroDBusAddActivationService.cmake @@ -0,0 +1,42 @@ +# Install a DBus ".service" file, so that a program can be started via DBus activation. +# +# dbus_add_activation_service(inputfile) +# +# This macro will read the input file, generate a .service file from it, and install it +# into the right directory for the dbus server to find it. +# +# Note that in the case of custom install prefixes, the user will have to add the prefix +# to XDG_DATA_DIRS before starting the DBus server. +# +# Example: +# dbus_add_activation_service(org.mydomain.myapp.service.in) +# +# The file org.mydomain.myapp.service.in contains: +# +# [D-BUS Service] +# Name=org.mydomain.myapp +# Exec=@CMAKE_INSTALL_PREFIX@/bin/myapp +# +# This will create and install PREFIX/share/dbus-1/services/org.mydomain.myapp.service +# +# See http://techbase.kde.org/Development/Tutorials/D-Bus/Autostart_Services for +# a more complete documentation. +# +# Copyright 2012 David Faure <faure@kde.org> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. + +macro(dbus_add_activation_service _sources) + foreach(_i ${_sources}) + get_filename_component(_service_file ${_i} ABSOLUTE) + string(REGEX REPLACE "\\.service.*$" ".service" _output_file ${_i}) + set(_target ${CMAKE_CURRENT_BINARY_DIR}/${_output_file}) + configure_file(${_service_file} ${_target}) + install(FILES ${_target} DESTINATION ${DBUS_SERVICES_INSTALL_DIR}) + endforeach() +endmacro() |