diff options
Diffstat (limited to 'cmake/QtDbusHelpers.cmake')
-rw-r--r-- | cmake/QtDbusHelpers.cmake | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/cmake/QtDbusHelpers.cmake b/cmake/QtDbusHelpers.cmake index 8b972adc92..26e98eff27 100644 --- a/cmake/QtDbusHelpers.cmake +++ b/cmake/QtDbusHelpers.cmake @@ -1,6 +1,14 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + # helper to set up a qdbusxml2cpp rule function(qt_create_qdbusxml2cpp_command target infile) - qt_parse_all_arguments(arg "qt_create_qdbusxml2cpp_command" "ADAPTOR;INTERFACE" "BASENAME" "FLAGS" ${ARGN}) + cmake_parse_arguments(PARSE_ARGV 2 arg + "ADAPTOR;INTERFACE" + "BASENAME" + "FLAGS") + _qt_internal_validate_all_args_are_parsed(arg) + if((arg_ADAPTOR AND arg_INTERFACE) OR (NOT arg_ADAPTOR AND NOT arg_INTERFACE)) message(FATAL_ERROR "qt_create_dbusxml2cpp_command needs either ADAPTOR or INTERFACE.") endif() @@ -44,12 +52,19 @@ function(qt_create_qdbusxml2cpp_command target infile) set(header_file "${file_name}.h") set(source_file "${file_name}.cpp") - add_custom_command(OUTPUT "${header_file}" "${source_file}" + set(header_file_full "${CMAKE_CURRENT_BINARY_DIR}/${file_name}.h") + set(source_file_full "${CMAKE_CURRENT_BINARY_DIR}/${file_name}.cpp") + + add_custom_command(OUTPUT "${header_file_full}" "${source_file_full}" COMMAND ${QT_CMAKE_EXPORT_NAMESPACE}::qdbusxml2cpp ${arg_FLAGS} "${option}" "${header_file}:${source_file}" "${absolute_in_file_path}" DEPENDS "${absolute_in_file_path}" ${QT_CMAKE_EXPORT_NAMESPACE}::qdbusxml2cpp WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + COMMAND_EXPAND_LISTS VERBATIM) - target_sources("${target}" PRIVATE "${header_file}" "${source_file}") + target_sources("${target}" PRIVATE + "${header_file_full}" + "${source_file_full}" + ) endfunction() |