aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/qml/Qt6QmlMacros.cmake20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/qml/Qt6QmlMacros.cmake b/src/qml/Qt6QmlMacros.cmake
index 3e69d5d12e..886d3cdc2c 100644
--- a/src/qml/Qt6QmlMacros.cmake
+++ b/src/qml/Qt6QmlMacros.cmake
@@ -671,6 +671,20 @@ macro(_qt_internal_genex_getoption var target property)
set(${var} "$<BOOL:$<TARGET_PROPERTY:${target},${property}>>")
endmacro()
+function(_qt_internal_extend_qml_import_paths import_paths_var)
+ set(local_var ${${import_paths_var}})
+
+ # prepend extra import path which is a current module's build dir: we need
+ # this to ensure correct importing of QML modules when having a prefix-build
+ # with QLibraryInfo::path(QLibraryInfo::QmlImportsPath) pointing to the
+ # install location
+ if(QT_BUILDING_QT AND QT_WILL_INSTALL)
+ list(PREPEND local_var -I "${QT_BUILD_DIR}/${INSTALL_QMLDIR}")
+ endif()
+
+ set(${import_paths_var} ${local_var} PARENT_SCOPE)
+endfunction()
+
function(_qt_internal_target_enable_qmllint target)
set(lint_target ${target}_qmllint)
if(TARGET ${lint_target})
@@ -719,6 +733,8 @@ function(_qt_internal_target_enable_qmllint target)
list(APPEND import_args -I "${QT_QML_OUTPUT_DIRECTORY}")
endif()
+ _qt_internal_extend_qml_import_paths(import_args)
+
set(cmd
${QT_TOOL_COMMAND_WRAPPER_PATH}
${QT_CMAKE_EXPORT_NAMESPACE}::qmllint
@@ -1081,6 +1097,8 @@ function(qt6_target_compile_qml_to_cpp target)
list(APPEND common_args -I "${import_path}")
endforeach()
+ _qt_internal_extend_qml_import_paths(common_args)
+
# we explicitly depend on qmldir (due to `-i ${qmldir_file}`) but also
# implicitly on the generated qmltypes file, which is a part of qmldir
set(qml_module_files)
@@ -1556,7 +1574,6 @@ if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
endfunction()
endif()
-
function(qt6_target_qml_sources target)
get_target_property(uri ${target} QT_QML_MODULE_URI)
@@ -1690,6 +1707,7 @@ function(qt6_target_qml_sources target)
# The application binary directory is part of the default import path.
list(APPEND import_paths -I "$<TARGET_PROPERTY:${target},BINARY_DIR>")
endif()
+ _qt_internal_extend_qml_import_paths(import_paths)
set(cachegen_args
${import_paths}
-i "${qmldir_file}"