diff --git a/cmake/QtDbusHelpers.cmake b/cmake/QtDbusHelpers.cmake index 8b972adc923..95f1f9aa131 100644 --- a/cmake/QtDbusHelpers.cmake +++ b/cmake/QtDbusHelpers.cmake @@ -44,12 +44,18 @@ 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}" VERBATIM) - target_sources("${target}" PRIVATE "${header_file}" "${source_file}") + target_sources("${target}" PRIVATE + "${header_file_full}" + "${source_file_full}" + ) endfunction()