From 5fd882803e6bf642e17e7f8c32b35bcd6c7a6e50 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 16 Apr 2019 12:53:24 +0200 Subject: Fix dbusxml2cpp custom command invocation Use absolute paths for source files, and relative paths plus a correct working directory for output files. This is required to work around a limitation of the dbusxml2cpp tool where it splits a command line option on a colon ":". Windows paths contain colons, and that breaks the internal logic of the tool when passing absolute paths. Change-Id: Ic653f1317ae4f68bb2f488c117fe48c34310c76e Reviewed-by: Tobias Hunger --- cmake/QtBuild.cmake | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index f881c3eabd..70dee6851c 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -1161,14 +1161,20 @@ function(qt_create_qdbusxml2cpp_command target infile) set(file_name ${arg_BASENAME}) endif() + # Use absolute file path for the source file and set the current working directory to the + # current binary directory, because setting an absolute path for the header:source combo option + # does not work. Splitting on ":" breaks inside the dbus tool when running on Windows + # due to ":" being contained in the drive path (e.g C:\foo.h:C:\foo.cpp). + get_filename_component(absolute_in_file_path "${infile}" ABSOLUTE) - set(header_file "${CMAKE_CURRENT_BINARY_DIR}/${file_name}.h") - set(source_file "${CMAKE_CURRENT_BINARY_DIR}/${file_name}.cpp") + set(header_file "${file_name}.h") + set(source_file "${file_name}.cpp") add_custom_command(OUTPUT "${header_file}" "${source_file}" - COMMAND ${QT_CMAKE_EXPORT_NAMESPACE}::qdbusxml2cpp ${arg_FLAGS} "${option}" "${header_file}:${source_file}" "${infile}" - DEPENDS "${infile}" - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + COMMAND ${QT_CMAKE_EXPORT_NAMESPACE}::qdbusxml2cpp ${arg_FLAGS} "${option}" + "${header_file}:${source_file}" "${absolute_in_file_path}" + DEPENDS "${absolute_in_file_path}" + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" VERBATIM) target_sources("${target}" PRIVATE "${header_file}" "${source_file}") -- cgit v1.2.3