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