Warning, /frameworks/krunner/KF6KRunnerMacros.cmake is written in an unsupported language. File is not indexed.
0001 #.rst: 0002 # KF6KRunnerMacros 0003 # --------------------------- 0004 # 0005 # This module provides the ``krunner_configure_test`` function which takes the test- and runner target as a parameter. 0006 # This will add the compile definitions for the AbstractRunnerTest header. 0007 # In case of DBus runners the DESKTOP_FILE parameter must be set. This is required for loading the runner from the 0008 # metadata file. 0009 # SPDX-FileCopyrightText: 2020 Alexander Lohnau <alexander.lohnau@gmx.de> 0010 # SPDX-License-Identifier: BSD-2-Clause 0011 0012 function(krunner_configure_test TEST_TARGET RUNNER_TARGET) 0013 include(CMakeParseArguments) 0014 set(options) 0015 set(oneValueArgs DESKTOP_FILE) 0016 set(multiValueArgs) 0017 cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) 0018 get_target_property(target_type ${RUNNER_TARGET} TYPE) 0019 if(target_type STREQUAL "EXECUTABLE") 0020 if(NOT ARGS_DESKTOP_FILE) 0021 message(FATAL_ERROR "In case of a dbus runner the DESKTOP_FILE must be provided") 0022 endif() 0023 target_compile_definitions(${TEST_TARGET} 0024 PRIVATE 0025 KRUNNER_DBUS_RUNNER_TESTING=1 0026 KRUNNER_TEST_DBUS_EXECUTABLE="$<TARGET_FILE:${RUNNER_TARGET}>" 0027 KRUNNER_TEST_DESKTOP_FILE="${ARGS_DESKTOP_FILE}" 0028 ) 0029 else() 0030 target_compile_definitions(${TEST_TARGET} 0031 PRIVATE 0032 KRUNNER_DBUS_RUNNER_TESTING=0 0033 KRUNNER_TEST_RUNNER_PLUGIN_DIR="$<TARGET_FILE_DIR:${RUNNER_TARGET}>" 0034 KRUNNER_TEST_RUNNER_PLUGIN_NAME="$<TARGET_FILE_NAME:${RUNNER_TARGET}>" 0035 ) 0036 endif() 0037 add_dependencies(${TEST_TARGET} ${RUNNER_TARGET}) 0038 endfunction()