diff options
author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2020-07-29 16:36:00 +0200 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2020-07-30 10:58:47 +0200 |
commit | f4f63ce44f36c3125aa1d554af7c912b00022b29 (patch) | |
tree | 2947ace079501094de8b20bde418cc1c27902ee6 /src/qml/Qt6QmlMacros.cmake | |
parent | 4df637cc454824ddc6f42ea81d7d1ecdea2b7d46 (diff) |
Qt6QmlMacros.cmake: take the file path into consideration when copying QML files
When a QML plugin has QML files, and those files are
placed inside a directory (other than the root), qmldir
will also refer to those files prefixed with that directory.
Likewise, when the plugin is installed, the QML files will
need to copied so that they mirror this structure.
(This is also how qmake does it).
This patch will implement the same logic for cmake, so that
we check if the QML files are located elsewhere than the
root of the project, and if so, copy them into the same
location in the installation folder.
Change-Id: Iaebe4144d9b10b7d4922b53c546ca2f76bc0be1e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'src/qml/Qt6QmlMacros.cmake')
-rw-r--r-- | src/qml/Qt6QmlMacros.cmake | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/qml/Qt6QmlMacros.cmake b/src/qml/Qt6QmlMacros.cmake index 8414c65254..5d81fd7be6 100644 --- a/src/qml/Qt6QmlMacros.cmake +++ b/src/qml/Qt6QmlMacros.cmake @@ -448,11 +448,15 @@ function(qt6_target_qml_files target) set(file_contents "") foreach(qml_file IN LISTS arg_FILES) + get_filename_component(qml_file_dir "${qml_file}" DIRECTORY) + if (NOT "${qml_file_dir}" STREQUAL "") + set(qml_file_dir "/${qml_file_dir}") + endif() if (install_qml_files AND qml_module_install_dir) if (NOT QT_WILL_INSTALL) - file(COPY "${qml_file}" DESTINATION "${qml_module_install_dir}") + file(COPY "${qml_file}" DESTINATION "${qml_module_install_dir}${qml_file_dir}") else() - install(FILES "${qml_file}" DESTINATION "${qml_module_install_dir}") + install(FILES "${qml_file}" DESTINATION "${qml_module_install_dir}${qml_file_dir}") endif() endif() |