diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-06-04 11:40:23 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-06-04 12:10:07 +0200 |
commit | cb293ee3afea3fe0cfabee58b4d34c278f17b709 (patch) | |
tree | 03462ece4ee468cacd8ef251c7e41a92699416c3 /src/qml/Qt6QmlBuildInternals.cmake | |
parent | 3f4088256c7712cbc757dd4d8835a3d4b272b4ee (diff) |
CMake: Allow using existing backing target for a new qml module
qtwayland has a case where the backing target is always created by
qt_internal_add_module and it is promoted to a qml module
conditionally only if Qt::Qml target exists.
qt_internal_add_qml_module always tries to create a backing target.
Allow passing an internal only NO_CREATE_BACKING_TARGET option to
re-use an existing target, while still applying necessary qml-specific
install rules.
Amends 1c4ba17015fe99da48ce73fab75ecc60cf9cb975
Task-number: QTBUG-91621
Change-Id: I15f4da4fd3a3ab991c78e8c77975677a0d820fd5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/Qt6QmlBuildInternals.cmake')
-rw-r--r-- | src/qml/Qt6QmlBuildInternals.cmake | 53 |
1 files changed, 34 insertions, 19 deletions
diff --git a/src/qml/Qt6QmlBuildInternals.cmake b/src/qml/Qt6QmlBuildInternals.cmake index 5196a2f7ed..48ae45cf8c 100644 --- a/src/qml/Qt6QmlBuildInternals.cmake +++ b/src/qml/Qt6QmlBuildInternals.cmake @@ -74,17 +74,29 @@ function(qt_internal_add_qml_module target) # Args used by qt_internal_add_qml_module directly, which should not be passed to any other # functions. + # + # NO_CREATE_BACKING_TARGET option skips the creation of the backing target. It is useful in + # the case where the backing target already exists, a plugin target should still be created + # and the qml specific install rules should still apply to the backing target. + # # INSTALL_SOURCE_QMLTYPES takes a path to an existing plugins.qmltypes file that should be # installed. + # # INSTALL_SOURCE_QMLDIR takes a path to an existing qmldir file that should be installed. + set(internal_option_args + NO_CREATE_BACKING_TARGET + ) + set(internal_single_args INSTALL_SOURCE_QMLTYPES - INSTALL_SOURCE_QMLDIR) + INSTALL_SOURCE_QMLDIR + ) set(option_args ${module_option_args} ${qml_module_option_args} ${ignore_option_args} + ${internal_option_args} ) set(single_args ${module_single_args} @@ -130,24 +142,27 @@ function(qt_internal_add_qml_module target) set(plugin_args "") if(NOT arg_PLUGIN_TARGET STREQUAL target) - # Create the backing target now to handle module-related things - qt_remove_args(module_args - ARGS_TO_REMOVE - ${ignore_option_args} - ${qml_module_option_args} - ${qml_module_single_args} - ${qml_module_multi_args} - ${internal_single_args} - OUTPUT_DIRECTORY - INSTALL_DIRECTORY - ALL_ARGS - ${option_args} - ${single_args} - ${multi_args} - ARGS - ${ARGN} - ) - qt_internal_add_module(${target} ${module_args}) + if(NOT arg_NO_CREATE_BACKING_TARGET) + # Create the backing target now to handle module-related things + qt_remove_args(module_args + ARGS_TO_REMOVE + ${ignore_option_args} + ${qml_module_option_args} + ${qml_module_single_args} + ${qml_module_multi_args} + ${internal_option_args} + ${internal_single_args} + OUTPUT_DIRECTORY + INSTALL_DIRECTORY + ALL_ARGS + ${option_args} + ${single_args} + ${multi_args} + ARGS + ${ARGN} + ) + qt_internal_add_module(${target} ${module_args}) + endif() else() # Since we are not creating a separate backing target, we have to pass # through the default args to the plugin target creation instead |