From 01f7fe8f78e72dcda6000c70fd8b1d5bfefc46f2 Mon Sep 17 00:00:00 2001 From: Henri Chain Date: Fri, 10 Jul 2020 13:12:25 +0000 Subject: Add ecm_generate_dbus_service_file Summary: It serves as a replacement for `kdbusaddons_generate_dbus_service_file`. An application can be a DBus-activated service just fine without using KDBusAddons. Moreover, this new module uses named arguments for future-proofing, and adds support for specifying a `SystemdService`. It also cleans up the confusion on what the "path" is about: Rather than requiring to specify executable and path separately, we just extract the executable file name on Windows, if necessary. Usage: ``` ecm_generate_dbus_service_file(NAME org.kde.kded5 EXECUTABLE ${KDE_INSTALL_FULL_BINDIR}/kded5 SYSTEMD_SERVICE plasma-kded) ``` Test Plan: * Was able to generate a kded service file * Was able to generate a kded service file with `SystemdUnit` * Verified that it moaned when executable wasn't an absolute path * Untested on Windwos Reviewers: #frameworks, davidedmundson, kossebau, kfunk, habacker Subscribers: kde-frameworks-devel, kde-buildsystem Tags: #frameworks, #build_system Differential Revision: https://phabricator.kde.org/D29051 --- .../check_tree.cmake.in | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/ECMGenerateDBusServiceFileTest/check_tree.cmake.in (limited to 'tests/ECMGenerateDBusServiceFileTest/check_tree.cmake.in') diff --git a/tests/ECMGenerateDBusServiceFileTest/check_tree.cmake.in b/tests/ECMGenerateDBusServiceFileTest/check_tree.cmake.in new file mode 100644 index 00000000..c5fe51c9 --- /dev/null +++ b/tests/ECMGenerateDBusServiceFileTest/check_tree.cmake.in @@ -0,0 +1,20 @@ +set(EXPECTED "@CMAKE_CURRENT_SOURCE_DIR@/expected") +set(ACTUAL "@CMAKE_INSTALL_PREFIX@") + +# Compares files in two directories, emits a fatal error if the top level files are different +# Takes a directory of expected files, and a directory of output files +function(compare_dirs expected output ) + file(GLOB files "${expected}/*") + foreach(file ${files}) + get_filename_component(name ${file} NAME) + + execute_process(COMMAND ${CMAKE_COMMAND} -E compare_files ${file} "${output}/${name}" + RESULT_VARIABLE test_result + ) + If (NOT test_result EQUAL 0) + message(FATAL_ERROR "Test failed: ${file} doesn't match ${output}/${name}!") + endif() + endforeach() +endfunction() + +compare_dirs(${EXPECTED} ${ACTUAL}/test ) -- cgit v1.2.1