aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/Qt6QmlMacros.cmake
diff options
context:
space:
mode:
authorAndrei Golubev <andrei.golubev@qt.io>2021-12-23 16:44:53 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-01-26 22:43:20 +0000
commit1f06056d048e9b1988ea658e438e33c7bfd003f3 (patch)
tree51fc1f864ab3d92f0d1b7ac3f642777ea068ed92 /src/qml/Qt6QmlMacros.cmake
parenta7e092f05f4ba2e1ebf043185f1c49a66a913088 (diff)
Make qmltc-processed targets depend on qmltypes of linked QML modules
Be safe in a multi-threaded build by making sure that all relevant qmltypes are available before we start to compile code with qmltc Unlike other tools, qmltc by design only cares about explicitly linked QML modules. Using non-explicitly-linked ones would typically result in C++ compilation errors as linker would be unable to find symbols Change-Id: I504c5c14fbba1f225d5904034f50fec99602c678 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit 549fad86bc68ef948330eb28c96791dd1daadbd3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/qml/Qt6QmlMacros.cmake')
-rw-r--r--src/qml/Qt6QmlMacros.cmake19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/qml/Qt6QmlMacros.cmake b/src/qml/Qt6QmlMacros.cmake
index d53ec373a7..1ef71bded0 100644
--- a/src/qml/Qt6QmlMacros.cmake
+++ b/src/qml/Qt6QmlMacros.cmake
@@ -1088,6 +1088,25 @@ function(qt6_target_compile_qml_to_cpp target)
list(APPEND qml_module_files ${output_dir}/${qmltypes_file})
endif()
+ get_target_property(potential_qml_modules ${target} LINK_LIBRARIES)
+ foreach(lib ${potential_qml_modules})
+ # get any QT_QML_MODULE_ property, this way we can tell whether we deal
+ # with QML module target or not. use output dir as it's used later
+ get_target_property(external_output_dir ${lib} QT_QML_MODULE_OUTPUT_DIRECTORY)
+ if(NOT external_output_dir) # not a QML module, so not interesting
+ continue()
+ endif()
+
+ get_target_property(external_qmltypes_file ${lib} QT_QML_MODULE_TYPEINFO)
+ if(external_qmltypes)
+ # add linked module's qmltypes file to a list of target
+ # dependencies. unlike qmllint or other tooling, qmltc only cares
+ # about explicitly linked libraries. things like plugins are not
+ # supported by design and would result in C++ compilation errors
+ list(APPEND qml_module_files ${external_output_dir}/${external_qmltypes_file})
+ endif()
+ endforeach()
+
foreach(qml_file_src IN LISTS arg_FILES)
if(NOT qml_file_src MATCHES "\\.(qml)$")
list(APPEND non_qml_files ${qml_file_src})