aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorJarkko Koivikko <jarkko.koivikko@code-q.fi>2021-02-20 11:40:25 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-02-23 16:51:41 +0000
commite925ebd39c458341913950848b618277848dda42 (patch)
tree1564330253164f99c93b67cdffe3cbe1fd11d98d /src/qml
parentc6e17b85fc7ea6273376f94f24a357c0565beb2a (diff)
CMake: Handle the case of QML resources in the BINARY directory
Qt Virtual Keyboard copies some QML resources to the BINARY directory for dynamic configuration of resources. _qt_internal_quick_compiler_process_resources assumes that all QML source files are located under the SOURCE directory. This is perfectly fine as long as the SOURCE and BINARY directories are located on the same drive in Windows. Otherwise, the relative path cannot be resolved and cmake is aborted because a directory cannot be created below. Fix this problem by making sure that the relative path is resolved against the correct base directory. Change-Id: I93e31e9f2720d448a48b6e8075cee0c01f59b584 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 1bc4fb2e400c4c5865282a711d1a443ca0ab26fa) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/Qt6QmlMacros.cmake7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/qml/Qt6QmlMacros.cmake b/src/qml/Qt6QmlMacros.cmake
index c86bcb1cb8..01ee8fc4d4 100644
--- a/src/qml/Qt6QmlMacros.cmake
+++ b/src/qml/Qt6QmlMacros.cmake
@@ -985,7 +985,12 @@ function(_qt_internal_quick_compiler_process_resources target resource_name)
foreach(file IN LISTS qml_files)
get_filename_component(file_absolute ${file} ABSOLUTE)
- file(RELATIVE_PATH file_relative ${CMAKE_CURRENT_SOURCE_DIR} ${file_absolute})
+ string(FIND "${file_absolute}" "${CMAKE_SOURCE_DIR}" start_index_of_source_dir)
+ if (start_index_of_source_dir EQUAL 0)
+ file(RELATIVE_PATH file_relative ${CMAKE_CURRENT_SOURCE_DIR} ${file_absolute})
+ else()
+ file(RELATIVE_PATH file_relative ${CMAKE_CURRENT_BINARY_DIR} ${file_absolute})
+ endif()
__qt_get_relative_resource_path_for_file(file_resource_path ${file})
if (arg_PREFIX STREQUAL "/")
# TO_CMAKE_PATH does not clean up cases such as //Foo