aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-11-17 17:45:25 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-11-18 19:15:57 +0100
commit8a54a6fc2efd13f0310ec71793f624cdf28bd1c9 (patch)
treec25bb86027e37fde845fb315845b4522352742df /src
parent9bae2ace7acb8b237b61df77c913732371565d61 (diff)
CMake: Record resource object file information for static builds
After any call to qt6_add_resources we need to record info about the resource object files. These will be embedded into the appropriate prl files to ensure that any application built with qmake links in the resources (only relevant for static Qt builds). The implementation is a bit ugly, but it gets the job done for now. It checks for the existence of an internal Qt function in the public macros and calls it if it's available. That will only happen when doing Qt builds. For regular app projects the functions will not be called, but we don't generate .prl files for such projects either way. Note that this comes with the same limitation as described in the changes for fixing QTBUG-88425. Specifically, the functions will only record resource object files for targets built as part of the current CMake invocation (aka just one repo for non-top-level builds). This handles the most common issues, but is not a complete fix. Task-number: QTBUG-87702 Change-Id: If632fdf9867cec4b24b1c6136d23ee9d8b56e650 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/qml/Qt6QmlMacros.cmake14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/qml/Qt6QmlMacros.cmake b/src/qml/Qt6QmlMacros.cmake
index dcdff7ca0f..733dd6725e 100644
--- a/src/qml/Qt6QmlMacros.cmake
+++ b/src/qml/Qt6QmlMacros.cmake
@@ -379,7 +379,7 @@ function(qt6_add_qml_module target)
)
set(resource_target "Foo")
- QT6_ADD_RESOURCES(${target} ${qmldir_resource_name}
+ qt6_add_resources(${target} ${qmldir_resource_name}
PREFIX ${target_resource_prefix}
FILES "${qmldir_file}"
OUTPUT_TARGETS resource_targets
@@ -390,6 +390,12 @@ function(qt6_add_qml_module target)
EXPORT "${arg_RESOURCE_EXPORT}"
DESTINATION "${arg_INSTALL_LOCATION}"
)
+
+ # When building a static Qt, we need to record information about the compiled resource
+ # object files to embed them into .prl files.
+ if(COMMAND qt_internal_record_rcc_object_files)
+ qt_internal_record_rcc_object_files("${target}" "${resource_targets}")
+ endif()
endif()
else()
# Copy QMLDIR file to build directory
@@ -588,6 +594,12 @@ function(qt6_target_qml_files target)
EXPORT "${target_resource_export}"
DESTINATION "${qml_module_install_dir}"
)
+
+ # When building a static Qt, we need to record information about the compiled resource
+ # object files to embed them into .prl files.
+ if(COMMAND qt_internal_record_rcc_object_files)
+ qt_internal_record_rcc_object_files("${target}" "${resource_targets}")
+ endif()
endif()
set(file_contents "")