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 1c4ba17015
Task-number: QTBUG-91621
Change-Id: I15f4da4fd3a3ab991c78e8c77975677a0d820fd5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
parent
3f4088256c
commit
cb293ee3af
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue