aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/doc/src/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/doc/src/cmake')
-rw-r--r--src/qml/doc/src/cmake/cmake-properties.qdoc187
-rw-r--r--src/qml/doc/src/cmake/cmake-variables.qdoc1
-rw-r--r--src/qml/doc/src/cmake/qt_add_qml_module.qdoc12
-rw-r--r--src/qml/doc/src/cmake/qt_deploy_qml_imports.qdoc22
-rw-r--r--src/qml/doc/src/cmake/qt_generate_deploy_qml_app_script.qdoc5
-rw-r--r--src/qml/doc/src/cmake/qt_generate_foreign_qml_types.qdoc (renamed from src/qml/doc/src/cmake/qt6_generate_foreign_qml_types.qdoc)23
-rw-r--r--src/qml/doc/src/cmake/qt_import_qml_plugins.qdoc2
-rw-r--r--src/qml/doc/src/cmake/qt_query_qml_module.qdoc3
-rw-r--r--src/qml/doc/src/cmake/qt_target_qml_sources.qdoc2
9 files changed, 243 insertions, 14 deletions
diff --git a/src/qml/doc/src/cmake/cmake-properties.qdoc b/src/qml/doc/src/cmake/cmake-properties.qdoc
new file mode 100644
index 0000000000..eccc815eca
--- /dev/null
+++ b/src/qml/doc/src/cmake/cmake-properties.qdoc
@@ -0,0 +1,187 @@
+/****************************************************************************
+**
+** Copyright (C) 2022 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\group cmake-source-file-properties-qtqml
+\title CMake Source File Properties in Qt6 Qml
+
+\l{CMake Commands in Qt6 Qml}{CMake Commands} know about the following CMake
+source file properties:
+
+\sa{CMake Property Reference}
+*/
+
+
+/*!
+\page cmake-source-file-property-QT_QML_INTERNAL_TYPE.html
+\ingroup cmake-source-file-properties-qtqml
+
+\title QT_QML_INTERNAL_TYPE
+\target cmake-source-file-property-QT_QML_INTERNAL_TYPE
+
+\summary {Marks a QML file as providing an internal type.}
+
+\cmakepropertysince 6.2
+
+Set this property to \c TRUE to indicate that the \c{.qml} file provides an internal type.
+
+\sa{qml-source-file-properties}{qt_target_qml_sources}
+*/
+
+
+/*!
+\page cmake-source-file-property-QT_QML_SINGLETON_TYPE.html
+\ingroup cmake-source-file-properties-qtqml
+
+\title QT_QML_SINGLETON_TYPE
+\target cmake-source-file-property-QT_QML_SINGLETON_TYPE
+
+\summary {Marks a QML file as providing a singleton type.}
+
+\cmakepropertysince 6.2
+
+A \c{.qml} file that provides a singleton type needs to have its \c QT_QML_SINGLETON_TYPE source
+property set to \c TRUE to ensure that the singleton command is written into the
+\l{Module Definition qmldir Files}{qmldir} file.
+This must be done in addition to the QML file containing the \c {pragma Singleton} statement.
+
+See \l{qt_target_qml_sources_example}{qt_target_qml_sources()} for an example on
+how to set the \c QT_QML_SINGLETON_TYPE property.
+
+\sa{qml-source-file-properties}{qt_target_qml_sources}
+*/
+
+
+/*!
+\page cmake-source-file-property-QT_QML_SKIP_CACHEGEN.html
+\ingroup cmake-source-file-properties-qtqml
+
+\title QT_QML_SKIP_CACHEGEN
+\target cmake-source-file-property-QT_QML_SKIP_CACHEGEN
+
+\summary {Excludes a file from being compiled to byte code.}
+
+\cmakepropertysince 6.2
+
+Set this property to \c TRUE to prevent the \c{.qml} file from being compiled to byte code.
+The file will still be added to the \c target as a resource in uncompiled form
+(see \l{qmlcachegen-auto}{Caching compiled QML sources}).
+
+\sa{qml-source-file-properties}{qt_target_qml_sources}
+*/
+
+
+/*!
+\page cmake-source-file-property-QT_QML_SKIP_QMLDIR_ENTRY.html
+\ingroup cmake-source-file-properties-qtqml
+
+\title QT_QML_SKIP_QMLDIR_ENTRY
+\target cmake-source-file-property-QT_QML_SKIP_QMLDIR_ENTRY
+
+\summary {Excludes a file from being added as a type to the QML module's typeinfo file.}
+
+\cmakepropertysince 6.2
+
+Set this property to \c TRUE to prevent
+the \c{.qml} file from being added as a type to the QML module's typeinfo file
+(see \l{qmldir-autogeneration}{Auto-generating \c{qmldir} and typeinfo files}).
+
+\sa{qml-source-file-properties}{qt_target_qml_sources}
+*/
+
+
+/*!
+\page cmake-source-file-property-QT_QML_SKIP_QMLLINT.html
+\ingroup cmake-source-file-properties-qtqml
+
+\title QT_QML_SKIP_QMLLINT
+\target cmake-source-file-property-QT_QML_SKIP_QMLLINT
+
+\summary {Prevents a file from being included in automatic qmllint processing.}
+
+\cmakepropertysince 6.2
+
+Set this property to \c TRUE to prevent the file from being included in
+\l{qmllint-auto}{automatic qmllint processing}.
+
+\sa{qml-source-file-properties}{qt_target_qml_sources}
+*/
+
+
+/*!
+\page cmake-source-file-property-QT_QML_SOURCE_TYPENAME.html
+\ingroup cmake-source-file-properties-qtqml
+
+\title QT_QML_SOURCE_TYPENAME
+\target cmake-source-file-property-QT_QML_SOURCE_TYPENAME
+
+\summary {Overrides the type name provided by the file.}
+
+\cmakepropertysince 6.2
+
+Use this property to override the \c QML type name provided by this file.
+
+\sa{qml-source-file-properties}{qt_target_qml_sources}
+*/
+
+
+/*!
+\page cmake-source-file-property-QT_QML_SOURCE_VERSIONS.html
+\ingroup cmake-source-file-properties-qtqml
+
+\title QT_QML_SOURCE_VERSIONS
+\target cmake-source-file-property-QT_QML_SOURCE_VERSIONS
+
+\summary {Specifies a custom set of versions for a type.}
+
+\cmakepropertysince 6.2
+
+When the file needs to provide type entries for a custom set of versions,
+for example when the QML types were first introduced in a minor patch
+version after the \c{.0} release, specify those versions using this property.
+
+\sa{qml-source-file-properties}{qt_target_qml_sources}
+*/
+
+
+/*!
+\page cmake-source-file-property-QT_QMLTC_FILE_BASENAME.html
+\ingroup cmake-source-file-properties-qtqml
+
+\title QT_QMLTC_FILE_BASENAME
+\target cmake-source-file-property-QT_QMLTC_FILE_BASENAME
+
+\summary {Specifies a non-default .h and .cpp file name.}
+
+\cmakepropertysince 6.3
+\preliminarycmakeproperty
+
+Use this property to specify a non-default \c .h and \c .cpp file name, which helps to resolve
+conflicting file names.
+
+\sa{qt_target_compile_qml_to_cpp}
+*/
diff --git a/src/qml/doc/src/cmake/cmake-variables.qdoc b/src/qml/doc/src/cmake/cmake-variables.qdoc
index 8f5b87b1cb..df01534d66 100644
--- a/src/qml/doc/src/cmake/cmake-variables.qdoc
+++ b/src/qml/doc/src/cmake/cmake-variables.qdoc
@@ -27,7 +27,6 @@
/*!
\page cmake-variable-QT_QML_OUTPUT_DIRECTORY.html
-\ingroup cmake-variables
\ingroup cmake-variables-qtqml
\title QT_QML_OUTPUT_DIRECTORY
diff --git a/src/qml/doc/src/cmake/qt_add_qml_module.qdoc b/src/qml/doc/src/cmake/qt_add_qml_module.qdoc
index d357497e24..00381d086d 100644
--- a/src/qml/doc/src/cmake/qt_add_qml_module.qdoc
+++ b/src/qml/doc/src/cmake/qt_add_qml_module.qdoc
@@ -34,6 +34,8 @@
\brief Defines a QML module.
+\cmakecommandsince 6.2
+
\section1 Synopsis
\badcode
@@ -50,6 +52,7 @@ qt_add_qml_module(
[TYPEINFO typeinfo]
[IMPORTS ...]
[OPTIONAL_IMPORTS ...]
+ [DEFAULT_IMPORTS ...]
[DEPENDENCIES ...]
[IMPORT_PATH ...]
[SOURCES ...]
@@ -467,6 +470,15 @@ like \c qmllint. Versions can be specified in the same way as for \c IMPORTS.
Each module listed here will be added as an \c{optional import} entry in the
generated \l{Module Definition qmldir Files}{qmldir} file.
+\c DEFAULT_IMPORTS specifies which of the optional imports are the default entries
+that should be loaded by tooling. One entry should be specified for every group of
+\c OPTIONAL_IMPORTS in the module. As optional imports are only resolved at runtime,
+tooling like qmllint cannot in general know which of the optional imports should
+be resolved. To remedy this, you can specify one of the optional imports as the
+default import; tooling will then pick it. If you have one optional import that
+gets used at runtime without any further configuration, that is an ideal candidate
+for the default import.
+
\c DEPENDENCIES provides a list of other QML modules that this module depends
on, but doesn't necessarily import. It would typically be used for dependencies
that only exist at the C++ level, such as a module registering a class to QML
diff --git a/src/qml/doc/src/cmake/qt_deploy_qml_imports.qdoc b/src/qml/doc/src/cmake/qt_deploy_qml_imports.qdoc
index 0282e2347e..369e698c39 100644
--- a/src/qml/doc/src/cmake/qt_deploy_qml_imports.qdoc
+++ b/src/qml/doc/src/cmake/qt_deploy_qml_imports.qdoc
@@ -42,6 +42,8 @@ project.
\preliminarycmakecommand
+\include cmake-qml-qt-finalize-target-warning.cmake
+
\section1 Synopsis
\badcode
@@ -97,7 +99,7 @@ named by the \c{PLUGINS_FOUND} option, if given. This is often passed as the
cmake_minimum_required(VERSION 3.16...3.22)
project(MyThings)
-find_package(Qt6 REQUIRED COMPONENTS Core Qml)
+find_package(Qt6 6.3 REQUIRED COMPONENTS Core Qml)
qt_standard_project_setup()
qt_add_executable(MyApp main.cpp)
@@ -113,7 +115,23 @@ set(deploy_script "${CMAKE_CURRENT_BINARY_DIR}/deploy_MyApp.cmake")
file(GENERATE OUTPUT ${deploy_script} CONTENTS "
include(\"${QT_DEPLOY_SUPPORT}\")
qt_deploy_qml_imports(
- EXECUTABLE \"\${QT_DEPLOY_BIN_DIR}/$<TARGET_FILE_NAME:MyApp>\"
+ # Deploy QML modules used by MyApp
+ TARGET MyApp
+
+ # The found QML plugins are stored in the plugins_found variable
+ PLUGINS_FOUND plugins_found
+
+ # The QML modules will be deployed into a custom directory
+ QML_DIR \"myqmldir\"
+
+ # Qt QML modules will be skipped, only project-created QML modules will be deployed
+ NO_QT_IMPORTS
+)
+# Deploy application runtime dependencies and runtime dependencies
+# of the found QML module plugins.
+qt_deploy_runtime_dependencies(
+ EXECUTABLE \${QT_DEPLOY_BIN_DIR}/$<TARGET_FILE_NAME:MyApp>
+ ADDITIONAL_MODULES \${plugins_found}
)
")
diff --git a/src/qml/doc/src/cmake/qt_generate_deploy_qml_app_script.qdoc b/src/qml/doc/src/cmake/qt_generate_deploy_qml_app_script.qdoc
index 1fae4ef9d1..360d602f8c 100644
--- a/src/qml/doc/src/cmake/qt_generate_deploy_qml_app_script.qdoc
+++ b/src/qml/doc/src/cmake/qt_generate_deploy_qml_app_script.qdoc
@@ -36,8 +36,11 @@
\include cmake-find-package-qml.qdocinc
+\cmakecommandsince 6.3
\preliminarycmakecommand
+\include cmake-qml-qt-finalize-target-warning.cmake
+
\section1 Synopsis
\badcode
@@ -122,7 +125,7 @@ same target.
cmake_minimum_required(VERSION 3.16...3.22)
project(MyThings)
-find_package(Qt6 REQUIRED COMPONENTS Core Qml)
+find_package(Qt6 6.3 REQUIRED COMPONENTS Core Qml)
qt_standard_project_setup()
qt_add_executable(MyApp main.cpp)
diff --git a/src/qml/doc/src/cmake/qt6_generate_foreign_qml_types.qdoc b/src/qml/doc/src/cmake/qt_generate_foreign_qml_types.qdoc
index 07cdd92543..8f1d6522be 100644
--- a/src/qml/doc/src/cmake/qt6_generate_foreign_qml_types.qdoc
+++ b/src/qml/doc/src/cmake/qt_generate_foreign_qml_types.qdoc
@@ -26,20 +26,24 @@
****************************************************************************/
/*!
-\page qt6_generate_foreign_qml_types.html
+\page qt_generate_foreign_qml_types.html
\ingroup cmake-commands-qtqml
-\title qt6_generate_foreign_qml_types
+\title qt_generate_foreign_qml_types
\target qt6_generate_foreign_qml_types
\summary{Registers types from one target in a QML module.}
+\include cmake-find-package-qml.qdocinc
+
+\preliminarycmakecommand
+
\section1 Synopsis
\badcode
-qt_add_qml_module(
- foreign_target
- qml_lib_target
+qt_generate_foreign_qml_types(
+ source_target
+ destination_qml_target
)
\endcode
@@ -48,8 +52,9 @@ qt_add_qml_module(
\section1 Description
-\c qt6_generate_foreign_qml_types enables the registration of types marked via QML registration
-macros (like \l QML_ELEMENT) in \c foreign_lib in the QML module \c qml_lib_target.
+\c qt_generate_foreign_qml_types extracts types marked via QML registration
+macros (like \l QML_ELEMENT) from \c source_target and registers them as foreign
+types in the QML module \c destination_qml_target.
This can be useful when one wants to create a library with optional QML integration, without
depending directly on QML.
@@ -70,14 +75,14 @@ class MyClass : public QObject
\badcode
# CMakeLists.txt
qt_add_library(mylib myclass.h ...)
-target_link_libraries(mylib Qt::Core Qt::QmlIntegration)
+target_link_libraries(mylib PRIVATE Qt::Core Qt::QmlIntegration)
qt_add_qml_module(mylib_declarative
VERSION 1.0
URI "mylib"
...
)
-qt6_generate_foreign_qml_types(mylib mylib_declarative)
+qt_generate_foreign_qml_types(mylib mylib_declarative)
\endcode
\note In the example above, \c mylib does not depend on QtQml or QtQuick, but only on the
diff --git a/src/qml/doc/src/cmake/qt_import_qml_plugins.qdoc b/src/qml/doc/src/cmake/qt_import_qml_plugins.qdoc
index 639c7ad223..b720d6d592 100644
--- a/src/qml/doc/src/cmake/qt_import_qml_plugins.qdoc
+++ b/src/qml/doc/src/cmake/qt_import_qml_plugins.qdoc
@@ -34,6 +34,8 @@
\brief Ensures QML plugins needed by a target are imported for static builds.
+\cmakecommandsince 6.0
+
\section1 Synopsis
\badcode
diff --git a/src/qml/doc/src/cmake/qt_query_qml_module.qdoc b/src/qml/doc/src/cmake/qt_query_qml_module.qdoc
index b2ab6c7c86..ec017ba3e7 100644
--- a/src/qml/doc/src/cmake/qt_query_qml_module.qdoc
+++ b/src/qml/doc/src/cmake/qt_query_qml_module.qdoc
@@ -36,6 +36,7 @@
\include cmake-find-package-qml.qdocinc
+\cmakecommandsince 6.3
\preliminarycmakecommand
\section1 Synopsis
@@ -161,7 +162,7 @@ absolute. The meaning and usage of \c RESOURCES_DEPLOY_PATHS and
cmake_minimum_required(VERSION 3.16...3.22)
project(MyThings)
-find_package(Qt6 REQUIRED COMPONENTS Core Qml)
+find_package(Qt6 6.3 REQUIRED COMPONENTS Core Qml)
set(module_name "MyThings")
qt_add_qml_module(${module_name}
diff --git a/src/qml/doc/src/cmake/qt_target_qml_sources.qdoc b/src/qml/doc/src/cmake/qt_target_qml_sources.qdoc
index c5a7212caa..dc1178be29 100644
--- a/src/qml/doc/src/cmake/qt_target_qml_sources.qdoc
+++ b/src/qml/doc/src/cmake/qt_target_qml_sources.qdoc
@@ -34,6 +34,8 @@
\brief Add qml files and resources to an existing QML module target.
+\cmakecommandsince 6.2
+
\section1 Synopsis
\badcode