Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
cmake-variables.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2021 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4
/*!
5
\group cmake-variables-qtqml
6
\title CMake Global Variables in Qt6 Qml
7
8
\l{CMake Command Reference#Qt6::Qml}{CMake Commands} know about the following
9
global CMake variables:
10
11
*/
12
13
/*!
14
\page cmake-variable-qt-qml-output-directory.html
15
\ingroup cmake-variables-qtqml
16
17
\title QT_QML_OUTPUT_DIRECTORY
18
19
\summary{Base output directory below which QML modules will be created by default.}
20
21
The \l qt_add_qml_module() command accepts an
22
\c OUTPUT_DIRECTORY argument which specifies where the QML module's \c qmldir
23
file, typeinfo file and plugin library will be created. When that argument is
24
not used, the default value is based on the \c QT_QML_OUTPUT_DIRECTORY variable,
25
if it is set. If \c QT_QML_OUTPUT_DIRECTORY is not set, the default value
26
depends on the type of backing target (see the
27
\l{qt_add_qml_module#OUTPUT_DIRECTORY}{OUTPUT_DIRECTORY} documentation for
28
details).
29
30
When \c QT_QML_OUTPUT_DIRECTORY is set, the default output directory will be
31
formed by appending the QML module's \e{target path} (which is based on the
32
module URI) to \c QT_QML_OUTPUT_DIRECTORY.
33
The \c QT_QML_OUTPUT_DIRECTORY will also be added to the import path of the
34
\c qmllint and \c qmlcachegen tooling targets, allowing them to find other QML
35
modules under the same base location. This allows the project to use a source
36
directory structure that doesn't exactly match the URI structure of the QML
37
modules, or to merge sets of QML modules under a common base point.
38
39
\sa {Setting CMake variables and properties}
40
*/
41
42
/*!
43
\page cmake-variable-qt-qml-generate-qmlls-ini-no-cmake-calls.html
44
\ingroup cmake-variables-qtqml
45
46
\title QT_QML_GENERATE_QMLLS_INI_NO_CMAKE_CALLS
47
48
\summary{Customizes the value of no-cmake-calls in .qmlls.ini files for \QMLLS.}
49
\cmakevariablesince 6.10
50
51
\c QT_QML_GENERATE_QMLLS_INI_NO_CMAKE_CALLS is a boolean that controls the \c no-cmake-calls value in
52
\c{.qmlls.ini} files generated with the \l{QT_QML_GENERATE_QMLLS_INI} option. Set it to \c ON to disable
53
CMake calls by \QMLLS.
54
55
As this variable is used for IDE integration, it should normally not be set in a project itself, but
56
passed to CMake via an IDE or manually by passing
57
\code [text]
58
-DQT_QML_GENERATE_QMLLS_INI=ON -DQT_QML_GENERATE_QMLLS_INI_NO_CMAKE_CALLS=ON
59
\endcode
60
to the cmake executable.
61
62
This variable has no effect if \l{QT_QML_GENERATE_QMLLS_INI} is disabled.
63
64
\sa QT_QML_GENERATE_QMLLS_INI, {Configuring Automatic CMake Builds}
65
\sa {Setting CMake variables and properties}
66
*/
67
68
/*!
69
\page cmake-variable-qt-qml-generate-qmlls-ini.html
70
\ingroup cmake-variables-qtqml
71
72
\title QT_QML_GENERATE_QMLLS_INI
73
74
\summary{Enables autogeneration of .qmlls.ini files for \QMLLS.}
75
\warning This variable is deprecated since Qt 6.10. No replacement needed.
76
\cmakevariablesince 6.7
77
78
\c QT_QML_GENERATE_QMLLS_INI is a boolean that describes whether
79
\l qt_add_qml_module() calls generate \c{.qmlls.ini} files inside
80
the \b{source folder}, into each subdirectory with a CMakeLists.txt file creating a QML module.
81
If \c{.qmlls.ini} files already exist there, then they are overwritten.
82
83
\note Using \c QT_QML_GENERATE_QMLLS_INI requires a CMake version >= 3.19.
84
85
These \c{.qmlls.ini} files contain the path to the last configured build directory,
86
and is needed by \l{\QMLLS} to find user defined modules. See also
87
\l{\QMLLS} about the other ways of passing build folders to \QMLLS.
88
89
As this variable is used for IDE integration, it should normally not be set in a project itself, but
90
passed to CMake via an IDE or manually by passing
91
\code [text]
92
-DQT_QML_GENERATE_QMLLS_INI=ON
93
\endcode
94
to the cmake executable.
95
96
\warning The files generated by \c QT_QML_GENERATE_QMLLS_INI are only valid for the current
97
configuration and should be ignored by your version control system. For Git, add \tt{**\/.qmlls.ini}
98
to your top-level project \c{.gitignore}, for example.
99
The globbing is required because .qmlls.ini files are generated in \e{all source
100
subdirectories} that define QML Modules.
101
102
\sa QT_QML_GENERATE_QMLLS_INI_NO_CMAKE_CALLS, {Configuring Automatic CMake Builds}
103
\sa {Setting CMake variables and properties}
104
*/
105
106
/*!
107
\page cmake-variable-qt-qml-no-cachegen.html
108
\ingroup cmake-variables-qtqml
109
110
\title QT_QML_NO_CACHEGEN
111
112
\summary{Disables compilation of QML files into bytecode or C++ code.}
113
\cmakevariablesince 6.8.1
114
115
\c QT_QML_NO_CACHEGEN is a CMake variable that can be set to disable the compilation of QML files
116
into bytecode or C++ code for QML targets created by
117
\l qt_add_qml_module().
118
119
It has the same effect as setting the \c{NO_CACHEGEN} option of
120
\l qt_add_qml_module(), but allows doing so on a per-directory or project
121
basis.
122
123
Turn on this option to reduce the number of build steps necessary to complete a build, and
124
thereby shorten the develop-debug iteration cycle.
125
126
To minimize application size, turn off this option, and instead use
127
\l{QT_DISCARD_FILE_CONTENTS}{QT_DISCARD_FILE_CONTENTS} to remove the QML files embedded into the
128
resource system.
129
130
The variable can be set in the project's CMakeLists.txt as follows:
131
\code [cmake]
132
set(QT_QML_NO_CACHEGEN TRUE)
133
qt_add_qml_module(MyModule
134
URI MyModule
135
VERSION 1.0
136
...
137
)
138
\endcode
139
140
\sa {Setting CMake variables and properties}
141
*/
142
143
/*!
144
\page cmake-variable-qt-qml-generate-aotstats.html
145
\ingroup cmake-variables-qtqml
146
147
\title QT_QML_GENERATE_AOTSTATS
148
149
\summary{Controls whether QML Compiler statistics collection is enabled.}
150
\cmakevariablesince 6.8.3
151
152
When a QML project is configured using \l qt_add_qml_module(), by default,
153
\l{QML script compiler#Obtaining statistics about the compilation of functions and bindings}{statistics}
154
from the compilation of QML code will be collected. You can explicitly opt in
155
or out of this by setting the \c{QT_QML_GENERATE_AOTSTATS} variable. It can be
156
set project-wide by passing
157
\code [text]
158
-DQT_QML_GENERATE_AOTSTATS=OFF
159
\endcode
160
to the CMake executable, or by setting it directly in the corresponding
161
CMakeLists.txt file before the first call to \l qt_add_qml_module().
162
\code [cmake]
163
set(QT_QML_GENERATE_AOTSTATS OFF)
164
\endcode
165
166
\sa {Setting CMake variables and properties}
167
*/
168
169
/*!
170
\page cmake-variable-qt-qmllint-no-context-property-dump.html
171
\ingroup cmake-variables-qtqml
172
173
\title QT_QMLLINT_CONTEXT_PROPERTY_DUMP
174
175
\summary{Enables dumping of context properties in lint targets.}
176
\cmakevariablesince 6.11
177
178
When the \c QT_QMLLINT_CONTEXT_PROPERTY_DUMP variable is enabled, \l{qmllint-auto}{linting targets}
179
created by \l qt_add_qml_module() will run \l qmlcontextpropertydump before running \l qmllint. This
180
allows \l qmllint to warn on the usage of context properties in QML.
181
182
To enable this feature, set the \c QT_QMLLINT_CONTEXT_PROPERTY_DUMP variable using
183
one of the following methods:
184
185
\list
186
\li Pass the option to the CMake executable:
187
\code [text]
188
-DQT_QMLLINT_CONTEXT_PROPERTY_DUMP=ON
189
\endcode
190
191
\li Add the setting to your \c CMakeLists.txt file before the first call to
192
\l qt_add_qml_module():
193
\code [cmake]
194
set(QT_QMLLINT_CONTEXT_PROPERTY_DUMP ON)
195
\endcode
196
\endlist
197
198
\sa {Setting CMake variables and properties}
199
*/
200
201
/*!
202
\page cmake-variable-qt-qml-no-qml-preview.html
203
\ingroup cmake-variables-qtqml
204
205
\title QT_QML_NO_QML_PREVIEW (global property)
206
207
\summary{Controls whether qmlpreview support is automatically set up for executables linking against Qt6::Qml.}
208
\cmakevariablesince 6.12
209
210
By default, every executable target that links against \c{Qt6::Qml}
211
automatically gets \l qmlpreview support set up for it at target finalization,
212
as if \l qt_add_qml_preview() had been called on it explicitly. Executable
213
targets that are themselves QML modules created by \l qt_add_qml_module() are
214
unaffected, as they already get \l qmlpreview support from that command.
215
216
Setting this variable to a true value disables the automatic behavior for all
217
targets. This skips the small amount of extra configure-time work spent
218
creating a preview target for each executable, which is worthwhile for projects
219
that don't use \l qmlpreview, for example applications that only drive QML
220
through a \l QJSEngine for scripting, or release and CI builds where live reload
221
is irrelevant. Disable it for an entire build by passing
222
\code [text]
223
-DQT_QML_NO_QML_PREVIEW=ON
224
\endcode
225
to the cmake executable, or set it in the project's \c CMakeLists.txt if preview
226
is never needed.
227
228
For finer control, individual targets can opt out with the
229
\l{cmake-target-property-QT_QML_NO_QML_PREVIEW}{QT_QML_NO_QML_PREVIEW}
230
property, or opt back in with \l qt_add_qml_preview() even when preview is
231
disabled globally.
232
233
\sa qt_add_qml_preview(), {cmake-target-property-QT_QML_NO_QML_PREVIEW}{QT_QML_NO_QML_PREVIEW}
234
\sa {Setting CMake variables and properties}
235
*/
qtdeclarative
src
qml
doc
src
cmake
cmake-variables.qdoc
Generated on
for Qt by
1.18.0