#.rst: # KF6KRunnerMacros # --------------------------- # # This module provides the ``krunner_configure_test`` function which takes the test- and runner target as a parameter. # This will add the compile definitions for the AbstractRunnerTest header. # In case of DBus runners the DESKTOP_FILE parameter must be set. This is required for loading the runner from the # metadata file. # SPDX-FileCopyrightText: 2020 Alexander Lohnau # SPDX-License-Identifier: BSD-2-Clause function(krunner_configure_test TEST_TARGET RUNNER_TARGET) include(CMakeParseArguments) set(options) set(oneValueArgs DESKTOP_FILE) set(multiValueArgs) cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) get_target_property(target_type ${RUNNER_TARGET} TYPE) if(target_type STREQUAL "EXECUTABLE") if(NOT ARGS_DESKTOP_FILE) message(FATAL_ERROR "In case of a dbus runner the DESKTOP_FILE must be provided") endif() target_compile_definitions(${TEST_TARGET} PRIVATE KRUNNER_DBUS_RUNNER_TESTING=1 KRUNNER_TEST_DBUS_EXECUTABLE="$" KRUNNER_TEST_DESKTOP_FILE="${ARGS_DESKTOP_FILE}" ) else() target_compile_definitions(${TEST_TARGET} PRIVATE KRUNNER_DBUS_RUNNER_TESTING=0 KRUNNER_TEST_RUNNER_PLUGIN_DIR="$" KRUNNER_TEST_RUNNER_PLUGIN_NAME="$" ) endif() add_dependencies(${TEST_TARGET} ${RUNNER_TARGET}) endfunction()