aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/Qt6QmlBuildInternals.cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2021-06-16 18:00:26 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2021-06-25 12:06:02 +0200
commit0bb503cd277e32895a74ad058f03a4c51a865b4a (patch)
tree805ff8e7731a32eef6da1fe37dfc7b00b3085ede /src/qml/Qt6QmlBuildInternals.cmake
parent1a78a6df1dd0c7139ab77231dbffbd6dd49992dd (diff)
CMake: Assign output targets to appropriate export sets
Plugin initializer targets should go to the plugin export set. The rest of the output targets (resources and qmlcache object libraries for now) should go the main backing target export set. Also generate the missing additional target info files for each export set. Pick-to: 6.2 Task-number: QTBUG-93257 Task-number: QTBUG-92933 Change-Id: I0b13a15459f3c6379bf87de1819fda97ade8c416 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Diffstat (limited to 'src/qml/Qt6QmlBuildInternals.cmake')
-rw-r--r--src/qml/Qt6QmlBuildInternals.cmake55
1 files changed, 46 insertions, 9 deletions
diff --git a/src/qml/Qt6QmlBuildInternals.cmake b/src/qml/Qt6QmlBuildInternals.cmake
index 5dd451554d..8cae67905b 100644
--- a/src/qml/Qt6QmlBuildInternals.cmake
+++ b/src/qml/Qt6QmlBuildInternals.cmake
@@ -259,17 +259,54 @@ function(qt_internal_add_qml_module target)
${add_qml_module_args}
OUTPUT_DIRECTORY ${arg_OUTPUT_DIRECTORY}
RESOURCE_PREFIX "/qt-project.org/imports"
- OUTPUT_TARGETS resource_targets
+ OUTPUT_TARGETS output_targets
)
- if(resource_targets)
- qt_install(TARGETS ${resource_targets}
- EXPORT "${INSTALL_CMAKE_NAMESPACE}${target}Targets"
- DESTINATION "${arg_INSTALL_DIRECTORY}"
- )
- qt_internal_record_rcc_object_files(${target} "${resource_targets}"
- INSTALL_DIRECTORY "${arg_INSTALL_DIRECTORY}"
- )
+ if(output_targets)
+ set(plugin_export_targets)
+ set(backing_lib_export_targets)
+
+ # Separate which output target should go to which export set.
+ # The plugin initializer library should go to the plugin export set, the rest should go to
+ # the backing lib export set.
+ # In the case when the plugin target is the same as the backing lib target, all of the
+ # output targets will go to the plugin export set.
+
+ foreach(output_target IN LISTS output_targets)
+ get_target_property(is_plugin_init ${output_target} _is_qt_plugin_init_target)
+ if(is_plugin_init)
+ list(APPEND plugin_export_targets ${output_target})
+ else()
+ list(APPEND backing_lib_export_targets ${output_target})
+ endif()
+ endforeach()
+
+ if(backing_lib_export_targets)
+ qt_install(TARGETS ${backing_lib_export_targets}
+ EXPORT "${INSTALL_CMAKE_NAMESPACE}${target}Targets"
+ DESTINATION "${arg_INSTALL_DIRECTORY}"
+ )
+ qt_internal_record_rcc_object_files(${target} "${backing_lib_export_targets}"
+ INSTALL_DIRECTORY "${arg_INSTALL_DIRECTORY}"
+ )
+
+ qt_internal_add_targets_to_additional_targets_export_file(
+ TARGETS ${backing_lib_export_targets}
+ EXPORT_NAME_PREFIX "${INSTALL_CMAKE_NAMESPACE}${target}"
+ )
+ endif()
+
+ if(arg_PLUGIN_TARGET AND plugin_export_targets)
+ qt_install(TARGETS ${plugin_export_targets}
+ EXPORT "${INSTALL_CMAKE_NAMESPACE}${arg_PLUGIN_TARGET}Targets"
+ DESTINATION "${arg_INSTALL_DIRECTORY}"
+ )
+
+ qt_internal_add_targets_to_additional_targets_export_file(
+ TARGETS ${plugin_export_targets}
+ EXPORT_NAME_PREFIX "${INSTALL_CMAKE_NAMESPACE}${arg_PLUGIN_TARGET}"
+ )
+ endif()
endif()
if(DEFINED arg_QML_FILES OR DEFINED arg_RESOURCES)