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-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
\badcode
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
90
As this variable is used for IDE integration, it should normally not be set in a project itself, but
91
passed to CMake via an IDE or manually by passing
92
\badcode
93
-DQT_QML_GENERATE_QMLLS_INI=ON
94
\endcode
95
to the cmake executable.
96
97
\warning The files generated by \c QT_QML_GENERATE_QMLLS_INI are only valid for the current
98
configuration and should be ignored by your version control system. For Git, add \tt{**\/.qmlls.ini}
99
to your top-level project \c{.gitignore}, for example.
100
The globbing is required because .qmlls.ini files are generated in \e{all source
101
subdirectories} that define QML Modules.
102
103
\sa QT_QML_GENERATE_QMLLS_INI_NO_CMAKE_CALLS, {Configuring Automatic CMake Builds}
104
\sa {Setting CMake variables and properties}
105
*/
106
107
/*!
108
\page cmake-variable-qt-qml-no-cachegen.html
109
\ingroup cmake-variables-qtqml
110
111
\title QT_QML_NO_CACHEGEN
112
113
\summary{Disables compilation of QML files into bytecode or C++ code.}
114
\cmakevariablesince 6.8.1
115
116
\c QT_QML_NO_CACHEGEN is a CMake variable that can be set to disable the compilation of QML files
117
into bytecode or C++ code for QML targets created by
118
\l qt_add_qml_module().
119
120
It has the same effect as setting the \c{NO_CACHEGEN} option of
121
\l qt_add_qml_module(), but allows doing so on a per-directory or project
122
basis.
123
124
Turn on this option to reduce the number of build steps necessary to complete a build, and
125
thereby shorten the develop-debug iteration cycle.
126
127
To minimize application size, turn off this option, and instead use
128
\l{QT_DISCARD_FILE_CONTENTS}{QT_DISCARD_FILE_CONTENTS} to remove the QML files embedded into the
129
resource system.
130
131
The variable can be set in the project's CMakeLists.txt as follows:
132
\badcode
133
set(QT_QML_NO_CACHEGEN TRUE)
134
qt_add_qml_module(MyModule
135
URI MyModule
136
VERSION 1.0
137
...
138
)
139
\endcode
140
141
\sa {Setting CMake variables and properties}
142
*/
143
144
/*!
145
\page cmake-variable-qt-qml-generate-aotstats.html
146
\ingroup cmake-variables-qtqml
147
148
\title QT_QML_GENERATE_AOTSTATS
149
150
\summary{Controls whether QML Compiler statistics collection is enabled.}
151
\cmakevariablesince 6.8.3
152
153
When a QML project is configured using \l qt_add_qml_module(), by default,
154
\l{QML script compiler#Obtaining statistics about the compilation of functions and bindings}{statistics}
155
from the compilation of QML code will be collected. You can explicitly opt in
156
or out of this by setting the \c{QT_QML_GENERATE_AOTSTATS} variable. It can be
157
set project-wide by passing
158
\badcode
159
-DQT_QML_GENERATE_AOTSTATS=OFF
160
\endcode
161
to the CMake executable, or by setting it directly in the corresponding
162
CMakeLists.txt file before the first call to \l qt_add_qml_module().
163
\badcode
164
set(QT_QML_GENERATE_AOTSTATS OFF)
165
\endcode
166
167
\sa {Setting CMake variables and properties}
168
*/
169
170
/*!
171
\page cmake-variable-qt-qmllint-no-context-property-dump.html
172
\ingroup cmake-variables-qtqml
173
174
\title QT_QMLLINT_CONTEXT_PROPERTY_DUMP
175
176
\summary{Enables dumping of context properties in lint targets.}
177
\cmakevariablesince 6.11
178
179
When the \c QT_QMLLINT_CONTEXT_PROPERTY_DUMP variable is enabled, \l{qmllint-auto}{linting targets}
180
created by \l qt_add_qml_module() will run \l qmlcontextpropertydump before running \l qmllint. This
181
allows \l qmllint to warn on the usage of context properties in QML.
182
183
To enable this feature, set the \c QT_QMLLINT_CONTEXT_PROPERTY_DUMP variable using
184
one of the following methods:
185
186
\list
187
\li Pass the option to the CMake executable:
188
\badcode
189
-DQT_QMLLINT_CONTEXT_PROPERTY_DUMP=ON
190
\endcode
191
192
\li Add the setting to your \c CMakeLists.txt file before the first call to
193
\l qt_add_qml_module():
194
\badcode
195
set(QT_QMLLINT_CONTEXT_PROPERTY_DUMP ON)
196
\endcode
197
\endlist
198
199
\sa {Setting CMake variables and properties}
200
*/
201
202
/*!
203
\page cmake-variable-qt-qml-no-qml-preview.html
204
\ingroup cmake-variables-qtqml
205
206
\title QT_QML_NO_QML_PREVIEW (global property)
207
208
\summary{Controls whether qmlpreview support is automatically set up for executables linking against Qt6::Qml.}
209
\cmakevariablesince 6.12
210
211
By default, every executable target that links against \c{Qt6::Qml}
212
automatically gets \l qmlpreview support set up for it at target finalization,
213
as if \l qt_add_qml_preview() had been called on it explicitly. Executable
214
targets that are themselves QML modules created by \l qt_add_qml_module() are
215
unaffected, as they already get \l qmlpreview support from that command.
216
217
Setting this variable to a true value disables the automatic behavior for all
218
targets. This skips the small amount of extra configure-time work spent
219
creating a preview target for each executable, which is worthwhile for projects
220
that don't use \l qmlpreview, for example applications that only drive QML
221
through a \l QJSEngine for scripting, or release and CI builds where live reload
222
is irrelevant. Disable it for an entire build by passing
223
\badcode
224
-DQT_QML_NO_QML_PREVIEW=ON
225
\endcode
226
to the cmake executable, or set it in the project's \c CMakeLists.txt if preview
227
is never needed.
228
229
For finer control, individual targets can opt out with the
230
\l{cmake-target-property-QT_QML_NO_QML_PREVIEW}{QT_QML_NO_QML_PREVIEW}
231
property, or opt back in with \l qt_add_qml_preview() even when preview is
232
disabled globally.
233
234
\sa qt_add_qml_preview(), {cmake-target-property-QT_QML_NO_QML_PREVIEW}{QT_QML_NO_QML_PREVIEW}
235
\sa {Setting CMake variables and properties}
236
*/
qtdeclarative
src
qml
doc
src
cmake
cmake-variables.qdoc
Generated on
for Qt by
1.16.1