Warning, /frameworks/krunner/KF5KRunnerMacros.cmake is written in an unsupported language. File is not indexed.

0001 #.rst:
0002 # KF5KRunnerMacros
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 # Since 5.104.0
0010 # SPDX-FileCopyrightText: 2020 Alexander Lohnau <alexander.lohnau@gmx.de>
0011 # SPDX-License-Identifier: BSD-2-Clause
0012 
0013 function(krunner_configure_test TEST_TARGET RUNNER_TARGET)
0014     include(CMakeParseArguments)
0015     set(options)
0016     set(oneValueArgs DESKTOP_FILE)
0017     set(multiValueArgs)
0018     cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
0019     get_target_property(target_type ${RUNNER_TARGET} TYPE)
0020     if(target_type STREQUAL "EXECUTABLE")
0021         if(NOT ARGS_DESKTOP_FILE)
0022             message(FATAL_ERROR "In case of a dbus runner the DESKTOP_FILE must be provided")
0023         endif()
0024         target_compile_definitions(${TEST_TARGET}
0025                 PRIVATE
0026                 KRUNNER_DBUS_RUNNER_TESTING=1
0027                 KRUNNER_TEST_DBUS_EXECUTABLE="$<TARGET_FILE:${RUNNER_TARGET}>"
0028                 KRUNNER_TEST_DESKTOP_FILE="${ARGS_DESKTOP_FILE}"
0029                 )
0030     else()
0031         target_compile_definitions(${TEST_TARGET}
0032                 PRIVATE
0033                 KRUNNER_DBUS_RUNNER_TESTING=0
0034                 KRUNNER_TEST_RUNNER_PLUGIN_DIR="$<TARGET_FILE_DIR:${RUNNER_TARGET}>"
0035                 KRUNNER_TEST_RUNNER_PLUGIN_NAME="$<TARGET_FILE_NAME:${RUNNER_TARGET}>"
0036                 )
0037     endif()
0038     add_dependencies(${TEST_TARGET} ${RUNNER_TARGET})
0039 endfunction()
0040 
0041 
0042 # Since 5.80.0
0043 function(configure_krunner_test TEST_TARGET RUNNER_TARGET)
0044     message(WARNING "From KF 5.104 onwards, you should call \"krunner_configure_test\" instead. This is semantically equivalent")
0045     krunner_configure_test(${TEST_TARGET} ${RUNNER_TARGET} ${ARGN})
0046 endfunction()