summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-04-16 12:53:24 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-04-16 14:40:25 +0000
commit5fd882803e6bf642e17e7f8c32b35bcd6c7a6e50 (patch)
tree1afd7e894657f9cf9a66895cacbb11797d991e88
parent51b7fbb62647226d4527f9bc695d8df2a7b194d2 (diff)
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 <tobias.hunger@qt.io>
-rw-r--r--cmake/QtBuild.cmake16
1 files 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}")