Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cmake-properties.qdoc
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4/*!
5\group cmake-global-properties-qtqml
6\title CMake Global Properties in Qt6 Qml
7
8\l{CMake Command Reference#Qt6::Qml}{CMake Commands} know about the following
9global CMake properties:
10
11\sa{CMake Property Reference}
12*/
13
14
15/*!
16\page cmake-global-property-qt-qmllinter-targets-folder.html
17\ingroup cmake-properties-qtqml
18\ingroup cmake-global-properties-qtqml
19
20\title QT_QMLLINTER_TARGETS_FOLDER
21
22\summary{Sets the FOLDER property for targets that belong to the QML linter.}
23
24\cmakepropertysince 6.5
25\preliminarycmakeproperty
26
27Name of the \l FOLDER for targets that are related to the QML linter.
28
29By default, this property is set to \c{QmlLinter}.
30
31This property only has an effect if CMake's \l USE_FOLDERS property is \c{ON}.
32
33You can enable folder support by calling
34\l{qt6_standard_project_setup}{qt_standard_project_setup}.
35*/
36
37
38/*!
39\group cmake-source-file-properties-qtqml
40\title CMake Source File Properties in Qt6 Qml
41
42\l{CMake Command Reference#Qt6::Qml}{CMake Commands} know about the following
43CMake source file properties:
44
45\sa{CMake Property Reference}
46*/
47
48
49/*!
50\page cmake-source-file-property-qt-qml-internal-type.html
51\ingroup cmake-source-file-properties-qtqml
52
53\title QT_QML_INTERNAL_TYPE
54
55\summary {Marks a QML file as providing an internal type.}
56
57\cmakepropertysince 6.2
58
59Set this property to \c TRUE to indicate that the \c{.qml} file provides an internal type.
60
61\sa{qml-source-file-properties}{qt_target_qml_sources}
62*/
63
64
65/*!
66\page cmake-source-file-property-qt-qml-singleton-type.html
67\ingroup cmake-source-file-properties-qtqml
68
69\title QT_QML_SINGLETON_TYPE
70
71\summary {Marks a QML file as providing a singleton type.}
72
73\cmakepropertysince 6.2
74
75A \c{.qml} file that provides a singleton type needs to have its \c QT_QML_SINGLETON_TYPE source
76property set to \c TRUE to ensure that the singleton command is written into the
77\l{Module Definition qmldir Files}{qmldir} file.
78This must be done in addition to the QML file containing the \c {pragma Singleton} statement.
79The source property must be set before \l{qt_add_qml_module}{creating} the module the
80singleton belongs to.
81
82See \l{qt_target_qml_sources_example}{qt_target_qml_sources()} for an example on
83how to set the \c QT_QML_SINGLETON_TYPE property.
84
85\sa{qml-source-file-properties}{qt_target_qml_sources}
86*/
87
88
89/*!
90\page cmake-source-file-property-qt-qml-skip-cachegen.html
91\ingroup cmake-source-file-properties-qtqml
92
93\title QT_QML_SKIP_CACHEGEN
94
95\summary {Excludes a file from being compiled to byte code.}
96
97\cmakepropertysince 6.2
98
99Set this property to \c TRUE to prevent the \c{.qml} file from being compiled to byte code.
100The file will still be added to the \c target as a resource in uncompiled form
101(see \l{qmlcachegen-auto}{Caching compiled QML sources}).
102
103\sa{qml-source-file-properties}{qt_target_qml_sources}
104*/
105
106
107/*!
108\page cmake-source-file-property-qt-qml-skip-qmldir-entry.html
109\ingroup cmake-source-file-properties-qtqml
110
111\title QT_QML_SKIP_QMLDIR_ENTRY
112
113\summary {Excludes a file from being added as a type to the QML module's typeinfo file.}
114
115\cmakepropertysince 6.2
116
117Set this property to \c TRUE to prevent
118the \c{.qml} file from being added as a type to the QML module's typeinfo file
119(see \l{qmldir-autogeneration}{Auto-generating \c{qmldir} and typeinfo files}).
120
121\sa{qml-source-file-properties}{qt_target_qml_sources}
122*/
123
124
125/*!
126\page cmake-source-file-property-qt-qml-skip-qmllint.html
127\ingroup cmake-source-file-properties-qtqml
128
129\title QT_QML_SKIP_QMLLINT
130
131\summary {Prevents a file from being included in automatic qmllint processing.}
132
133\cmakepropertysince 6.2
134
135Set this property to \c TRUE to prevent the file from being included in
136\l{qmllint-auto}{automatic qmllint processing}.
137
138\sa{qml-source-file-properties}{qt_target_qml_sources}
139*/
140
141
142/*!
143\page cmake-source-file-property-qt-qml-source-typename.html
144\ingroup cmake-source-file-properties-qtqml
145
146\title QT_QML_SOURCE_TYPENAME
147
148\summary {Overrides the type name provided by the file.}
149
150\cmakepropertysince 6.2
151
152Use this property to override the \c QML type name provided by this file.
153
154\sa{qml-source-file-properties}{qt_target_qml_sources}
155*/
156
157
158/*!
159\page cmake-source-file-property-qt-qml-source-versions.html
160\ingroup cmake-source-file-properties-qtqml
161
162\title QT_QML_SOURCE_VERSIONS
163
164\summary {Specifies a custom set of versions for a type.}
165
166\cmakepropertysince 6.2
167
168When the file needs to provide type entries for a custom set of versions,
169for example when the QML types were first introduced in a minor patch
170version after the \c{.0} release, specify those versions using this property.
171
172\sa{qml-source-file-properties}{qt_target_qml_sources}
173*/
174
175
176/*!
177\page cmake-source-file-property-qt-qmltc-file-basename.html
178\ingroup cmake-source-file-properties-qtqml
179
180\title QT_QMLTC_FILE_BASENAME
181
182\summary {Specifies a non-default .h and .cpp file name.}
183
184\cmakepropertysince 6.3
185\preliminarycmakeproperty
186
187Use this property to specify a non-default \c .h and \c .cpp file name, which helps to resolve
188conflicting file names.
189
190\sa{qmltc-cmake}
191*/
192
193/*!
194\page cmake-source-file-property-qt-qml-skip-type-compiler.html
195\ingroup cmake-source-file-properties-qtqml
196
197\title QT_QML_SKIP_TYPE_COMPILER
198
199\summary {Excludes a file from being compiled to C++ using qmltc.}
200
201\cmakepropertysince 6.4
202\preliminarycmakeproperty
203
204Set this property to \c TRUE to prevent the \c{.qml} file from being compiled to
205C++ during qmltc compilation.
206
207\sa{qmltc-cmake}
208*/
209
210/*!
211\page cmake-source-file-property-qt-qml-generate-android-java-class.html
212\ingroup cmake-source-file-properties-qtqml
213\ingroup cmake-android-build-properties
214
215\title QT_QML_GENERATE_ANDROID_JAVA_CLASS
216
217\summary {Marks a QML file for Java code generation.}
218
219\cmakepropertysince 6.8
220When using QML as a \l {Android: View} in Android via \l QtQuickView, you can choose
221the QML components to make available as generated Java classes usable from Android code.
222To mark a \c {.qml} file for code generation, set its \c QT_QML_GENERATE_ANDROID_JAVA_CLASS
223source property to \c TRUE. The source property must be set before
224\l {qt_add_qml_module}{creating} the module. \note The \c {.qml} file name must start with
225an uppercase letter and define a QML component. This property is valid only if
226\l QT_ANDROID_GENERATE_JAVA_QTQUICKVIEW_CONTENTS is defined.
227
228The source file property can be set like so:
229
230\badcode
231set_source_files_properties(MyMainItem.qml
232 PROPERTIES QT_QML_GENERATE_ANDROID_JAVA_CLASS TRUE)
233\endcode
234
235You can pass multiple files at once to set_source_files_properties:
236\badcode
237set(plain_qml_files
238 MyItem1.qml
239 MyItem2.qml
240 FancyButton.qml
241
242)
243
244set(qml_to_java_files
245 MyMainItem.qml
246 MyOtherMain.qml
247)
248
249set_source_files_properties(${qml_to_java_files}
250 PROPERTIES QT_QML_GENERATE_ANDROID_JAVA_CLASS TRUE
251)
252
253qt_add_qml_module(myapp
254 URI MyModule
255 QML_FILES ${plain_qml_files} ${qml_to_java_files}
256)
257\endcode
258
259\sa {Naming Custom QML Object Types}
260*/