Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
cmake-configure-variables.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/* NOTE: The variables documented here are available when running CMake, they
5** are not available in a deployment script. Both these and the set of
6** deploy-time variables are all members of the cmake-variables-qtcore
7** group.
8**/
9
10/*!
11\group cmake-variables-qtcore
12\title CMake Variables in Qt6 Core
13\brief Lists CMake variables defined in Qt6::Core.
14
15The following CMake variables are defined when Qt6::Core is loaded, for instance
16with
17
18\badcode
19find_package(Qt6 REQUIRED COMPONENTS Core)
20\endcode
21
22\sa{CMake Variable Reference}
23*/
24
25/*!
26\page cmake-variable-android-ndk-host-system-name.html
27\ingroup cmake-variables-qtcore
28
29\title ANDROID_NDK_HOST_SYSTEM_NAME
30\target cmake-variable-ANDROID_NDK_HOST_SYSTEM_NAME
31
32\summary {Android-specific architecture of the host system.}
33
34\cmakevariablesince 6.0
35\preliminarycmakevariable
36\cmakevariableandroidonly
37
38This is normally set by the Android NDK toolchain file. It is written out as
39part of the deployment settings for a target.
40
41\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()}
42*/
43
44/*!
45\page cmake-variable-android-sdk-root.html
46\ingroup cmake-variables-qtcore
47
48\title ANDROID_SDK_ROOT
49\target cmake-variable-ANDROID_SDK_ROOT
50
51\summary {Location of the Android SDK.}
52
53\cmakevariablesince 6.0
54\preliminarycmakevariable
55\cmakevariableandroidonly
56
57This specifies the location of the Android SDK when building for the Android platform.
58It is written out as part of the deployment settings for a target.
59
60\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()}.
61*/
62
63/*!
64\page cmake-variable-qt-android-application-arguments.html
65\ingroup cmake-variables-qtcore
66
67\title QT_ANDROID_APPLICATION_ARGUMENTS
68\target cmake-variable-QT_ANDROID_APPLICATION_ARGUMENTS
69
70\summary {List of arguments to pass to Android applications.}
71
72\cmakevariablesince 6.0
73\preliminarycmakevariable
74\cmakevariableandroidonly
75
76This contains a list of arguments to be passed to Android applications. It is written
77out as part of the deployment settings for a target.
78
79\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()}
80*/
81
82/*!
83\page cmake-variable-qt-android-deploy-release.html
84\ingroup cmake-variables-qtcore
85
86\title QT_ANDROID_DEPLOY_RELEASE
87\target cmake-variable-QT_ANDROID_DEPLOY_RELEASE
88
89\summary {Set the package type as a release}
90
91\cmakevariablesince 6.5.1
92\preliminarycmakevariable
93\cmakevariableandroidonly
94
95Setting \c{QT_ANDROID_DEPLOY_RELEASE} to true allows to create release package by passing --release
96flag to androiddeployqt tool.
97
98\sa {androiddeployqt}
99*/
100
101/*!
102\page cmake_variable-qt-android-multi-abi-forward-vars
103\ingroup cmake-variables-qtcore
104
105\title QT_ANDROID_MULTI_ABI_FORWARD_VARS
106\target cmake-variable-QT_ANDROID_MULTI_ABI_FORWARD_VARS
107
108\summary {Allows to share CMake variables in multi-ABI builds}
109
110\cmakevariablesince 6.4.2
111\preliminarycmakevariable
112\cmakevariableandroidonly
113
114The \c{QT_ANDROID_MULTI_ABI_FORWARD_VARS} variable allows specifying the list of
115CMake variables that need to be forwarded from the main ABI project to
116ABI-specific subprojects. Due to the specifics of the Multi-ABI project build
117process, there is no generic way to forward the CMake cache variables
118that are specified either in the command line or in another similar way.
119
120A typical use case for the variable is propagating CMake cache variables
121specified in the command line. For example, a project has two variables
122\c{PROJECT_WIDE_VARIABLE1} and \c{PROJECT_WIDE_VARIABLE2} that affect the
123project configuration:
124\badcode
125cmake_minimum_required(VERSION 3.18)
126
127project(MyProject LANGUAGES CXX)
128
129find_package(Qt6 REQUIRED COMPONENTS Core)
130
131qt_add_executable(MyApp main.cpp)
132
133if(PROJECT_WIDE_VARIABLE1)
134 target_sources(MyApp PRIVATE sourcefile1.cpp)
135endif()
136if(PROJECT_WIDE_VARIABLE2)
137 target_sources(MyApp PRIVATE sourcefile2.cpp)
138endif()
139\endcode
140
141The above contents of \c{CMakeLists.txt} enable you to control how
142\c{MyApp} is built by setting the corresponding CMake variables from the
143command line:
144\badcode
145qt-cmake -S<source directory> -B<build directory> \
146 -DPROJECT_WIDE_VARIABLE1=ON \
147 -DPROJECT_WIDE_VARIABLE2=ON \
148 -DQT_ANDROID_MULTI_ABI_FORWARD_VARS="PROJECT_WIDE_VARIABLE1;PROJECT_WIDE_VARIABLE2"
149\endcode
150
151When configuring the application for desktop, \c{PROJECT_WIDE_VARIABLE1} and
152\c{PROJECT_WIDE_VARIABLE2} are visible in CMake listings and scripts as global
153cache variables. This doesn't work for Android Multi-ABI builds because
154ABI-specific subprojects do not inherit the cache variables from the main-ABI
155project. This issue can be solved by passing the list of required variables to
156the \c{QT_ANDROID_MULTI_ABI_FORWARD_VARS} variable, so both
157\c{PROJECT_WIDE_VARIABLE1} and \c{PROJECT_WIDE_VARIABLE2} values will be
158propagated to the ABI-specific builds.
159
160The variable can be also defined in the project's CMakeLists.txt:
161\badcode
162...
163qt_add_executable(MyApp main.cpp)
164...
165if(ANDROID)
166 set(QT_ANDROID_MULTI_ABI_FORWARD_VARS "PROJECT_WIDE_VARIABLE1;PROJECT_WIDE_VARIABLE2")
167endif()
168...
169\endcode
170
171Setting the variable in this way allows you to have a predefined set of
172variables that will always be forwarded to abi-specific projects.
173
174\note The forwarding is done in the target finalizer, which is implicitly
175called when \l{qt6_add_executable}{qt_add_executable()} is used. The
176finalization occurs automatically when using CMake 3.19 or later.
177
178\sa {qt6_finalize_target}{qt_finalize_target()},
179 {qt6_add_executable}{qt_add_executable()}
180*/
181
182/*!
183\page cmake-variable-qt-android-build-all-abis.html
184\ingroup cmake-variables-qtcore
185
186\title QT_ANDROID_BUILD_ALL_ABIS
187\target cmake-variable-QT_ANDROID_BUILD_ALL_ABIS
188
189\summary {Enables building multi-ABI packages using the autodetected Qt for Android SDK list.}
190
191\cmakevariablesince 6.3
192\preliminarycmakevariable
193\cmakevariableandroidonly
194
195The option automatically detects available ABIs of Qt for Android and uses them to
196build a package. The automatic detection expects the default directory structure
197supplied by the Qt installer, with the corresponding naming of the directories.
198\include cmake-android-supported-abis.qdocinc
199The typical directory structure looks as below:
200\badcode
201/path/to/Qt/6.x.x
202 android_armv7
203 android_arm64_v8a
204 android_x86
205 android_x86_64
206 ...
207\endcode
208The auto-detected paths can be customized using one of \c{QT_PATH_ANDROID_ABI_<ABI>} variables.
209
210The variable is set to FALSE by default.
211
212\sa{QT_PATH_ANDROID_ABI_<ABI>}
213*/
214
215/*!
216\page cmake-variable-qt-android-abis.html
217\ingroup cmake-variables-qtcore
218
219\title QT_ANDROID_ABIS
220\target cmake-variable-QT_ANDROID_ABIS
221
222\summary {List of ABIs that the project packages are built for.}
223
224\cmakevariablesince 6.3
225\preliminarycmakevariable
226\cmakevariableandroidonly
227
228This variable specifies a list of ABIs to be used to build the project packages.
229\include cmake-android-supported-abis.qdocinc
230Each ABI should have the corresponding Qt for Android either installed or
231user-built. It's possible to specify the path to the Qt for Android ABI using
232the corresponding \c{QT_PATH_ANDROID_ABI_<ABI>} variable.
233
234\note \c{QT_ANDROID_BUILD_ALL_ABIS} has the higher priority and ignores the
235QT_ANDROID_ABIS logic.
236
237\sa{QT_PATH_ANDROID_ABI_<ABI>}, {QT_ANDROID_BUILD_ALL_ABIS}
238*/
239
240/*!
241\page cmake-variable-qt-path-android-abi.html
242\ingroup cmake-variables-qtcore
243
244\title QT_PATH_ANDROID_ABI_<ABI>
245\target cmake-variable-QT_PATH_ANDROID_ABI_<ABI>
246
247\summary {Set of variables to specify the path to Qt for Android for the corresponding ABI.}
248
249\cmakevariablesince 6.3
250\preliminarycmakevariable
251\cmakevariableandroidonly
252
253Each variable can be used to specify the path to Qt for Android for the corresponding ABI.
254\include cmake-android-supported-abis.qdocinc
255
256\sa{cmake-variable-QT_ANDROID_ABIS}{QT_ANDROID_ABIS}
257*/
258
259/*!
260\page cmake-variable-qt-android-sign-aab.html
261\ingroup cmake-variables-qtcore
262
263\title QT_ANDROID_SIGN_AAB
264\target cmake-variable-QT_ANDROID_SIGN_AAB
265
266\summary {Sign the .aab package with the specified keystore, alias and store password.}
267\cmakevariablesince 6.4
268\preliminarycmakevariable
269\cmakevariableandroidonly
270
271Sign the resulting package. The path of the keystore file, the alias of the key and passwords
272have to be specified by additional environment variables:
273\badcode
274 QT_ANDROID_KEYSTORE_PATH
275 QT_ANDROID_KEYSTORE_ALIAS
276 QT_ANDROID_KEYSTORE_STORE_PASS
277 QT_ANDROID_KEYSTORE_KEY_PASS
278\endcode
279Mentioned variables are used internally by \l{androiddeployqt}.
280
281\sa{androiddeployqt}
282*/
283
284/*!
285\page cmake-variable-qt-android-sign-apk.html
286\ingroup cmake-variables-qtcore
287
288\title QT_ANDROID_SIGN_APK
289\target cmake-variable-QT_ANDROID_SIGN_APK
290
291\summary {Sign the package with the specified keystore, alias and store password.}
292\cmakevariablesince 6.4
293\preliminarycmakevariable
294\cmakevariableandroidonly
295
296Sign the resulting package. The path of the keystore file, the alias of the key and passwords
297have to be specified by additional environment variables:
298\badcode
299 QT_ANDROID_KEYSTORE_PATH
300 QT_ANDROID_KEYSTORE_ALIAS
301 QT_ANDROID_KEYSTORE_STORE_PASS
302 QT_ANDROID_KEYSTORE_KEY_PASS
303\endcode
304Mentioned variables are used internally by \l{androiddeployqt}.
305
306\sa{androiddeployqt}
307*/
308
309/*!
310\page cmake-variable-qt-no-collect-build-tree-apk-deps.html
311\ingroup cmake-variables-qtcore
312
313\title QT_NO_COLLECT_BUILD_TREE_APK_DEPS
314\target cmake-variable-QT_NO_COLLECT_BUILD_TREE_APK_DEPS
315
316\summary {Prevents collecting of project-built shared library targets during Android deployment.}
317
318\cmakevariablesince 6.3
319\preliminarycmakevariable
320\cmakevariableandroidonly
321
322During project finalization, the build system collects the locations of
323all built shared library targets in the project.
324These locations are passed to \l androiddeployqt for deployment consideration when
325resolving dependencies between libraries.
326Set \c QT_NO_COLLECT_BUILD_TREE_APK_DEPS to \c TRUE to disable this behavior.
327
328\sa {qt6_finalize_project}{qt_finalize_project()}
329\sa {cmake-variable-QT_NO_COLLECT_IMPORTED_TARGET_APK_DEPS}{QT_NO_COLLECT_IMPORTED_TARGET_APK_DEPS}
330*/
331
332/*!
333\page cmake-variable-qt-no-collect-imported-target-apk-deps.html
334\ingroup cmake-variables-qtcore
335
336\title QT_NO_COLLECT_IMPORTED_TARGET_APK_DEPS
337\target cmake-variable-QT_NO_COLLECT_IMPORTED_TARGET_APK_DEPS
338
339\summary {Prevents collecting of imported targets during Android deployment.}
340
341\cmakevariablesince 6.5
342\preliminarycmakevariable
343\cmakevariableandroidonly
344
345When using CMake version 3.21 or later, the build system collects the locations of
346imported shared library targets that might be relevant for deployment.
347The collected targets are those that are reachable from the directory scope
348of the currently processed executable target. That includes the target's source directory
349scope and its parents.
350The collected locations are passed to \l androiddeployqt for deployment consideration when
351resolving dependencies between libraries.
352Set \c QT_NO_COLLECT_IMPORTED_TARGET_APK_DEPS to \c TRUE to disable this behavior.
353
354\sa {qt6_finalize_project}{qt_finalize_project()}
355\sa {cmake-variable-QT_NO_COLLECT_BUILD_TREE_APK_DEPS}{QT_NO_COLLECT_BUILD_TREE_APK_DEPS}
356*/
357
358/*!
359\page cmake-variable-qt-host-path.html
360\ingroup cmake-variables-qtcore
361
362\title QT_HOST_PATH
363\target cmake-variable-QT_HOST_PATH
364
365\summary {Location of the host Qt installation when cross-compiling.}
366
367\cmakevariablesince 6.0
368
369When cross-compiling, this must be set to the install location of Qt for the host
370platform. It is used to locate tools to be run on the host (\l{moc}, \l{rcc},
371\l{androiddeployqt}, and so on).
372*/
373
374/*!
375\page cmake-variable-qt-no-set-xcode-development-team-id.html
376\ingroup cmake-variables-qtcore
377
378\title QT_NO_SET_XCODE_DEVELOPMENT_TEAM_ID
379\target cmake-variable-QT_NO_SET_XCODE_DEVELOPMENT_TEAM_ID
380
381\summary {Disables providing a fallback team ID during target finalization on iOS.}
382
383\cmakevariablesince 6.1
384
385When finalizing an executable target on iOS,
386\l{qt6_finalize_target}{qt_finalize_target()} will populate the target's
387\c XCODE_ATTRIBUTE_DEVELOPMENT_TEAM property if it hasn't been set.
388Set \c QT_NO_SET_XCODE_DEVELOPMENT_TEAM_ID to true if you want to prevent this.
389*/
390
391/*!
392\page cmake-variable-qt-no-set-xcode-bundle-identifier.html
393\ingroup cmake-variables-qtcore
394
395\title QT_NO_SET_XCODE_BUNDLE_IDENTIFIER
396\target cmake-variable-QT_NO_SET_XCODE_BUNDLE_IDENTIFIER
397
398\summary {Disables providing a fallback app bundle ID during target finalization on iOS.}
399
400\cmakevariablesince 6.1
401
402When finalizing an executable target on iOS,
403\l{qt6_finalize_target}{qt_finalize_target()} will populate the target's
404\c XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER and
405\c MACOSX_BUNDLE_GUI_IDENTIFIER properties if they haven't been set.
406Set \c QT_NO_SET_XCODE_BUNDLE_IDENTIFIER to true if you want to prevent this.
407*/
408
409/*!
410\page cmake-variable-qt-enable-verbose-deployment.html
411\ingroup cmake-variables-qtcore
412
413\title QT_ENABLE_VERBOSE_DEPLOYMENT
414\target cmake-variable-QT_ENABLE_VERBOSE_DEPLOYMENT
415
416\summary {Enables verbose mode of deployment tools}
417
418\cmakevariablesince 6.3
419\preliminarycmakevariable
420
421Enables verbose mode of the \l androiddeployqt deployment tool when it is called
422internally at build time, usually during target finalization.
423
424This variable also changes the default verbosity of install-time deployment
425scripts for other platforms (see \l{qt6_deploy_runtime_dependencies()}), but it
426must be set before the first \c{find_package(Qt6)} call to have that effect.
427*/
428
429/*!
430\page cmake-variable-qt-deploy-support.html
431\ingroup cmake-variables-qtcore
432
433\title QT_DEPLOY_SUPPORT
434\target cmake-variable-QT_DEPLOY_SUPPORT
435
436\summary {Name of the file to include for setting up deployment support.}
437
438\cmakevariablesince 6.3
439\preliminarycmakevariable
440\note The value of this variable should never be modified by project code.
441
442This configure-phase variable is set by the Core package. It is intended to be
443used as the first line of any deployment script to ensure access to the
444deployment APIs provided by Qt. Such deployment scripts do not run during
445CMake's configure phase, they are executed during installation or as
446part of a post-build rule.
447
448The following example shows one way the variable would be used when installing
449an application, along with its runtime dependencies:
450
451\include cmake-deploy-modified-variable-values.qdocinc
452
453\sa {qt6_deploy_runtime_dependencies}{qt_deploy_runtime_dependencies()},
454 {qt6_deploy_qml_imports}{qt_deploy_qml_imports()}
455*/
456
457/*!
458\page cmake-variable-qt-no-standard-project-setup.html
459\ingroup cmake-variables-qtcore
460
461\title QT_NO_STANDARD_PROJECT_SETUP
462\target cmake-variable-QT_NO_STANDARD_PROJECT_SETUP
463
464\summary {Prevents subsequent calls to qt_standard_project_setup() from making any changes.}
465
466\cmakevariablesince 6.3
467
468The \l{qt6_standard_project_setup}{qt_standard_project_setup()} command is
469typically called in the top level \c{CMakeLists.txt} file of a project. In some
470scenarios, such projects may be absorbed as a child project of a larger project
471hierarchy. A parent project may want to prevent any child project from applying
472changes to the setup. The parent project can achieve this by setting
473\c{QT_NO_STANDARD_PROJECT_SETUP} to true before bringing in the child project
474via \l{add_subdirectory()}, \l{FetchContent_MakeAvailable()} or other similar
475methods provided by CMake.
476
477\sa {qt6_standard_project_setup}{qt_standard_project_setup()}
478*/
479
480/*!
481\page cmake-variable-qt-ios-launch-screen.html
482\ingroup cmake-variables-qtcore
483
484\title QT_IOS_LAUNCH_SCREEN
485\target cmake-variable-QT_IOS_LAUNCH_SCREEN
486
487\summary {Path to iOS launch screen storyboard used by all targets}
488
489\cmakevariablesince 6.4
490\preliminarycmakevariable
491\cmakevariableiosonly
492
493Specifies the path to an iOS launch screen storyboard file that will be used
494by all targets within a project.
495
496\sa {Launch Screens and Launch Images}
497*/