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 qt_standard_project_setup().
35*/
36
37
38/*!
39\group cmake-target-properties-qtqml
40\title CMake Target Properties in Qt6 Qml
41
42\l{CMake Command Reference#Qt6::Qml}{CMake Commands} know about the following
43CMake target properties:
44
45\sa{CMake Property Reference}
46*/
47
48
49/*!
50\page cmake-target-property-qt-qml-no-qml-preview.html
51\ingroup cmake-properties-qtqml
52\ingroup cmake-target-properties-qtqml
53
54\title QT_QML_NO_QML_PREVIEW (target property)
55\target cmake-target-property-QT_QML_NO_QML_PREVIEW
56
57\summary {Opts a target out of automatic qmlpreview target creation.}
58
59\cmakepropertysince 6.12
60
61Set this property to a true value on a target to prevent it from
62automatically getting a \l qmlpreview target created for it. By default, such
63a target is created for every executable that links against \c{Qt6::Qml}.
64
65This property only has an effect on the automatic behavior, which can also be
66disabled globally via \l QT_QML_NO_QML_PREVIEW. It has no effect on an explicit
67call to \l qt_add_qml_preview() for the same target.
68
69\sa{QT_QML_NO_QML_PREVIEW (global property)}, qt_add_qml_preview()
70*/
71
72
73/*!
74\group cmake-source-file-properties-qtqml
75\title CMake Source File Properties in Qt6 Qml
76
77\l{CMake Command Reference#Qt6::Qml}{CMake Commands} know about the following
78CMake source file properties:
79
80\sa{CMake Property Reference}
81*/
82
83
84/*!
85\page cmake-source-file-property-qt-qml-internal-type.html
86\ingroup cmake-source-file-properties-qtqml
87
88\title QT_QML_INTERNAL_TYPE
89
90\summary {Marks a QML file as providing an internal type.}
91
92\cmakepropertysince 6.2
93
94Set this property to \c TRUE to indicate that the \c{.qml} file provides an internal type.
95
96\sa{qml-source-file-properties}{qt_target_qml_sources}
97*/
98
99
100/*!
101\page cmake-source-file-property-qt-qml-singleton-type.html
102\ingroup cmake-source-file-properties-qtqml
103
104\title QT_QML_SINGLETON_TYPE
105
106\summary {Marks a QML file as providing a singleton type.}
107
108\cmakepropertysince 6.2
109
110A \c{.qml} file that provides a singleton type needs to have its \c QT_QML_SINGLETON_TYPE source
111property set to \c TRUE to ensure that the singleton command is written into the
112\l{Module Definition qmldir Files}{qmldir} file.
113This must be done in addition to the QML file containing the \c {pragma Singleton} statement.
114The source property must be set before \l{qt_add_qml_module}{creating} the module the
115singleton belongs to.
116
117See \l{qt_target_qml_sources_example}{qt_target_qml_sources()} for an example on
118how to set the \c QT_QML_SINGLETON_TYPE property.
119
120\sa{qml-source-file-properties}{qt_target_qml_sources}
121*/
122
123
124/*!
125\page cmake-source-file-property-qt-qml-skip-cachegen.html
126\ingroup cmake-source-file-properties-qtqml
127
128\title QT_QML_SKIP_CACHEGEN
129
130\summary {Excludes a file from being compiled to byte code.}
131
132\cmakepropertysince 6.2
133
134Set this property to \c TRUE to prevent the \c{.qml} file from being compiled to byte code.
135The file will still be added to the \c target as a resource in uncompiled form
136(see \l{qmlcachegen-auto}{Caching compiled QML sources}).
137
138\sa{qml-source-file-properties}{qt_target_qml_sources}
139*/
140
141
142/*!
143\page cmake-source-file-property-qt-qml-skip-qmldir-entry.html
144\ingroup cmake-source-file-properties-qtqml
145
146\title QT_QML_SKIP_QMLDIR_ENTRY
147
148\summary {Excludes a file from being added as a type to the QML module's typeinfo file.}
149
150\cmakepropertysince 6.2
151
152Set this property to \c TRUE to prevent
153the \c{.qml} file from being added as a type to the QML module's typeinfo file
154(see \l{qmldir-autogeneration}{Auto-generating \c{qmldir} and typeinfo files}).
155
156\sa{qml-source-file-properties}{qt_target_qml_sources}
157*/
158
159
160/*!
161\page cmake-source-file-property-qt-qml-skip-qmllint.html
162\ingroup cmake-source-file-properties-qtqml
163
164\title QT_QML_SKIP_QMLLINT
165
166\summary {Prevents a file from being included in automatic qmllint processing.}
167
168\cmakepropertysince 6.2
169
170Set this property to \c TRUE to prevent the file from being included in
171\l{qmllint-auto}{automatic qmllint processing}.
172
173\sa{qml-source-file-properties}{qt_target_qml_sources}
174*/
175
176
177/*!
178\page cmake-source-file-property-qt-qml-source-typename.html
179\ingroup cmake-source-file-properties-qtqml
180
181\title QT_QML_SOURCE_TYPENAME
182
183\summary {Overrides the type name provided by the file.}
184
185\cmakepropertysince 6.2
186
187Use this property to override the \c QML type name provided by this file.
188
189\sa{qml-source-file-properties}{qt_target_qml_sources}
190*/
191
192
193/*!
194\page cmake-source-file-property-qt-qml-source-versions.html
195\ingroup cmake-source-file-properties-qtqml
196
197\title QT_QML_SOURCE_VERSIONS
198
199\summary {Specifies a custom set of versions for a type.}
200
201\cmakepropertysince 6.2
202
203When the file needs to provide type entries for a custom set of versions,
204for example when the QML types were first introduced in a minor patch
205version after the \c{.0} release, specify those versions using this property.
206
207\sa{qml-source-file-properties}{qt_target_qml_sources}
208*/
209
210
211/*!
212\page cmake-source-file-property-qt-qmltc-file-basename.html
213\ingroup cmake-source-file-properties-qtqml
214
215\title QT_QMLTC_FILE_BASENAME
216
217\summary {Specifies a non-default .h and .cpp file name.}
218
219\cmakepropertysince 6.3
220\preliminarycmakeproperty
221
222Use this property to specify a non-default \c .h and \c .cpp file name, which helps to resolve
223conflicting file names.
224
225\sa{qmltc-cmake}
226*/
227
228/*!
229\page cmake-source-file-property-qt-qml-skip-type-compiler.html
230\ingroup cmake-source-file-properties-qtqml
231
232\title QT_QML_SKIP_TYPE_COMPILER
233
234\summary {Excludes a file from being compiled to C++ using qmltc.}
235
236\cmakepropertysince 6.4
237\preliminarycmakeproperty
238
239Set this property to \c TRUE to prevent the \c{.qml} file from being compiled to
240C++ during qmltc compilation.
241
242\sa{qmltc-cmake}
243*/
244
245/*!
246\page cmake-source-file-property-qt-qml-generate-android-java-class.html
247\ingroup cmake-source-file-properties-qtqml
248\ingroup cmake-android-build-properties
249
250\title QT_QML_GENERATE_ANDROID_JAVA_CLASS
251
252\summary {Marks a QML file for Java code generation.}
253
254\cmakepropertysince 6.8
255When using QML as a \l {Android: View} in Android via \l QtQuickView, you can choose
256the QML components to make available as generated Java classes usable from Android code.
257To mark a \c {.qml} file for code generation, set its \c QT_QML_GENERATE_ANDROID_JAVA_CLASS
258source property to \c TRUE. The source property must be set before
259\l {qt_add_qml_module}{creating} the module. \note The \c {.qml} file name must start with
260an uppercase letter and define a QML component. This property is valid only if
261\l QT_ANDROID_GENERATE_JAVA_QTQUICKVIEW_CONTENTS is defined.
262
263The source file property can be set like so:
264
265\badcode
266set_source_files_properties(MyMainItem.qml
267 PROPERTIES QT_QML_GENERATE_ANDROID_JAVA_CLASS TRUE)
268\endcode
269
270You can pass multiple files at once to set_source_files_properties:
271\badcode
272set(plain_qml_files
273 MyItem1.qml
274 MyItem2.qml
275 FancyButton.qml
276
277)
278
279set(qml_to_java_files
280 MyMainItem.qml
281 MyOtherMain.qml
282)
283
284set_source_files_properties(${qml_to_java_files}
285 PROPERTIES QT_QML_GENERATE_ANDROID_JAVA_CLASS TRUE
286)
287
288qt_add_qml_module(myapp
289 URI MyModule
290 QML_FILES ${plain_qml_files} ${qml_to_java_files}
291)
292\endcode
293
294\sa {Naming Custom QML Object Types}
295*/