diff options
author | Craig Scott <craig.scott@qt.io> | 2021-06-02 16:54:21 +1000 |
---|---|---|
committer | Craig Scott <craig.scott@qt.io> | 2021-06-04 16:54:52 +1000 |
commit | 1c4ba17015fe99da48ce73fab75ecc60cf9cb975 (patch) | |
tree | 1311d8cebc4007d43888477045ca534404f2f7ca /tools/qml | |
parent | 6432e00b954beec7d0c6bc9b70fed6191b87bd38 (diff) |
Refactor and update qml CMake API
The existing CMake API for qml modules had a number of
shortcomings. Refactor it to achieve the following:
- Clearly separate public and internal aspects.
- Re-use code from qtbase for adding plugins and module
targets rather than reimplementing close variations.
- Provide more robust and complete support for qmllint,
qmlcachegen and automatic generation of qmldir files.
- Reduce the steps needed for more common scenarios.
- Encourage the use of separate backing library and plugin
targets.
- Automatically generate the plugin class .cpp file where
possible.
- Specify .qml files directly through qml-specific API
elements rather than assuming they can be extracted
out of a set of resources.
[ChangeLog][QtQml] The qml CMake API has changed from 6.1
and is now out of Technical Preview status. The most
notable change is that .qml files should no longer be
specified as resources, there is dedicated handling for
them in the qt6_add_qml_module(). A related change is
that the qt6_target_qml_files() command has been replaced
by qt6_target_qml_sources(). More complete integration
with qmlcachegen, qmllint and qmldir generation is also
part of the CMake API.
Fixes: QTBUG-91621
Task-number: QTBUG-82598
Task-number: QTBUG-88763
Task-number: QTBUG-89274
Task-number: QTBUG-91444
Change-Id: I25aae1b0e89890394dfe2ba2824008164b2ca8d9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tools/qml')
-rw-r--r-- | tools/qml/CMakeLists.txt | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/tools/qml/CMakeLists.txt b/tools/qml/CMakeLists.txt index 96d030074d..099f3dc68d 100644 --- a/tools/qml/CMakeLists.txt +++ b/tools/qml/CMakeLists.txt @@ -48,15 +48,12 @@ qt_internal_add_resource(${target_name} "qml" ${qml_resource_files} ) - -#### Keys ignored in scope 1:.:.:qml.pro:<TRUE>: -# ICON = "resources/qml-64.png" -# QMAKE_TARGET_DESCRIPTION = "QML" "Runtime" -# QML_IMPORT_NAME = "QmlRuntime.Config" -# QML_IMPORT_VERSION = "1.0" - -## Scopes: -##################################################################### +# Turn the tool into its own self-contained qml module +qt6_add_qml_module(${target_name} + URI QmlRuntime.Config + VERSION 1.0 + NO_CREATE_PLUGIN_TARGET +) qt_internal_extend_target(${target_name} CONDITION TARGET Qt::Gui PUBLIC_LIBRARIES @@ -80,10 +77,3 @@ qt_internal_extend_target(${target_name} CONDITION QT_FEATURE_qml_debug DEFINES QT_QML_DEBUG_NO_WARNING ) - -set_target_properties(${target_name} PROPERTIES - QT_QML_MODULE_VERSION 1.0 - QT_QML_MODULE_URI QmlRuntime.Config -) - -qt6_qml_type_registration(${target_name}) |