1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
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
11\group cmake-variables-qtcore
12\title CMake Variables in Qt6 Core
13\brief Lists CMake variables defined in Qt6::Core.
15The following CMake variables are defined when Qt6::Core is loaded, for instance
19find_package(Qt6 REQUIRED COMPONENTS Core)
22\sa{CMake Variable Reference}
26\page cmake-variable-android-ndk-host-system-name.html
27\ingroup cmake-variables-qtcore
29\title ANDROID_NDK_HOST_SYSTEM_NAME
30\target cmake-variable-ANDROID_NDK_HOST_SYSTEM_NAME
32\summary {Android-specific architecture of the host system.}
34\cmakevariablesince 6.0
35\preliminarycmakevariable
36\cmakevariableandroidonly
38This is normally set by the Android NDK toolchain file. It is written out as
39part of the deployment settings for a target.
41\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()}
45\page cmake-variable-android-sdk-root.html
46\ingroup cmake-variables-qtcore
48\title ANDROID_SDK_ROOT
49\target cmake-variable-ANDROID_SDK_ROOT
51\summary {Location of the Android SDK.}
53\cmakevariablesince 6.0
54\preliminarycmakevariable
55\cmakevariableandroidonly
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.
60\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()}.
64\page cmake-variable-qt-android-application-arguments.html
65\ingroup cmake-variables-qtcore
67\title QT_ANDROID_APPLICATION_ARGUMENTS
68\target cmake-variable-QT_ANDROID_APPLICATION_ARGUMENTS
70\summary {List of arguments to pass to Android applications.}
72\cmakevariablesince 6.0
73\preliminarycmakevariable
74\cmakevariableandroidonly
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.
79\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()}
83\page cmake-variable-qt-android-deploy-release.html
84\ingroup cmake-variables-qtcore
86\title QT_ANDROID_DEPLOY_RELEASE
87\target cmake-variable-QT_ANDROID_DEPLOY_RELEASE
89\summary {Set the package type as a release}
91\cmakevariablesince 6.5.1
92\preliminarycmakevariable
93\cmakevariableandroidonly
95Setting \c{QT_ANDROID_DEPLOY_RELEASE} to true allows to create release package by passing --release
96flag to androiddeployqt tool.
102\page cmake_variable-qt-android-multi-abi-forward-vars
103\ingroup cmake-variables-qtcore
105\title QT_ANDROID_MULTI_ABI_FORWARD_VARS
106\target cmake-variable-QT_ANDROID_MULTI_ABI_FORWARD_VARS
108\summary {Allows to share CMake variables in multi-ABI builds}
110\cmakevariablesince 6.4.2
111\preliminarycmakevariable
112\cmakevariableandroidonly
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.
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:
125cmake_minimum_required(VERSION 3.18)
127project(MyProject LANGUAGES CXX)
129find_package(Qt6 REQUIRED COMPONENTS Core)
131qt_add_executable(MyApp main.cpp)
133if(PROJECT_WIDE_VARIABLE1)
134 target_sources(MyApp PRIVATE sourcefile1.cpp)
136if(PROJECT_WIDE_VARIABLE2)
137 target_sources(MyApp PRIVATE sourcefile2.cpp)
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
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"
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.
160The variable can be also defined in the project's CMakeLists.txt:
163qt_add_executable(MyApp main.cpp)
166 set(QT_ANDROID_MULTI_ABI_FORWARD_VARS "PROJECT_WIDE_VARIABLE1;PROJECT_WIDE_VARIABLE2")
171Setting the variable in this way allows you to have a predefined set of
172variables that will always be forwarded to abi-specific projects.
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.
178\sa {qt6_finalize_target}{qt_finalize_target()},
179 {qt6_add_executable}{qt_add_executable()}
183\page cmake-variable-qt-android-build-all-abis.html
184\ingroup cmake-variables-qtcore
186\title QT_ANDROID_BUILD_ALL_ABIS
187\target cmake-variable-QT_ANDROID_BUILD_ALL_ABIS
189\summary {Enables building multi-ABI packages using the autodetected Qt for Android SDK list.}
191\cmakevariablesince 6.3
192\preliminarycmakevariable
193\cmakevariableandroidonly
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:
208The auto-detected paths can be customized using one of \c{QT_PATH_ANDROID_ABI_<ABI>} variables.
210The variable is set to FALSE by default.
212\sa{QT_PATH_ANDROID_ABI_<ABI>}
216\page cmake-variable-qt-android-abis.html
217\ingroup cmake-variables-qtcore
219\title QT_ANDROID_ABIS
220\target cmake-variable-QT_ANDROID_ABIS
222\summary {List of ABIs that the project packages are built for.}
224\cmakevariablesince 6.3
225\preliminarycmakevariable
226\cmakevariableandroidonly
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.
234\note \c{QT_ANDROID_BUILD_ALL_ABIS} has the higher priority and ignores the
235QT_ANDROID_ABIS logic.
237\sa{QT_PATH_ANDROID_ABI_<ABI>}, {QT_ANDROID_BUILD_ALL_ABIS}
241\page cmake-variable-qt-path-android-abi.html
242\ingroup cmake-variables-qtcore
244\title QT_PATH_ANDROID_ABI_<ABI>
245\target cmake-variable-QT_PATH_ANDROID_ABI_<ABI>
247\summary {Set of variables to specify the path to Qt for Android for the corresponding ABI.}
249\cmakevariablesince 6.3
250\preliminarycmakevariable
251\cmakevariableandroidonly
253Each variable can be used to specify the path to Qt for Android for the corresponding ABI.
254\include cmake-android-supported-abis.qdocinc
256\sa{cmake-variable-QT_ANDROID_ABIS}{QT_ANDROID_ABIS}
260\page cmake-variable-qt-android-sign-aab.html
261\ingroup cmake-variables-qtcore
263\title QT_ANDROID_SIGN_AAB
264\target cmake-variable-QT_ANDROID_SIGN_AAB
266\summary {Sign the .aab package with the specified keystore, alias and store password.}
267\cmakevariablesince 6.4
268\preliminarycmakevariable
269\cmakevariableandroidonly
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:
274 QT_ANDROID_KEYSTORE_PATH
275 QT_ANDROID_KEYSTORE_ALIAS
276 QT_ANDROID_KEYSTORE_STORE_PASS
277 QT_ANDROID_KEYSTORE_KEY_PASS
279Mentioned variables are used internally by \l{androiddeployqt}.
285\page cmake-variable-qt-android-sign-apk.html
286\ingroup cmake-variables-qtcore
288\title QT_ANDROID_SIGN_APK
289\target cmake-variable-QT_ANDROID_SIGN_APK
291\summary {Sign the package with the specified keystore, alias and store password.}
292\cmakevariablesince 6.4
293\preliminarycmakevariable
294\cmakevariableandroidonly
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:
299 QT_ANDROID_KEYSTORE_PATH
300 QT_ANDROID_KEYSTORE_ALIAS
301 QT_ANDROID_KEYSTORE_STORE_PASS
302 QT_ANDROID_KEYSTORE_KEY_PASS
304Mentioned variables are used internally by \l{androiddeployqt}.
310\page cmake-variable-qt-no-collect-build-tree-apk-deps.html
311\ingroup cmake-variables-qtcore
313\title QT_NO_COLLECT_BUILD_TREE_APK_DEPS
314\target cmake-variable-QT_NO_COLLECT_BUILD_TREE_APK_DEPS
316\summary {Prevents collecting of project-built shared library targets during Android deployment.}
318\cmakevariablesince 6.3
319\preliminarycmakevariable
320\cmakevariableandroidonly
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.
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}
333\page cmake-variable-qt-no-collect-imported-target-apk-deps.html
334\ingroup cmake-variables-qtcore
336\title QT_NO_COLLECT_IMPORTED_TARGET_APK_DEPS
337\target cmake-variable-QT_NO_COLLECT_IMPORTED_TARGET_APK_DEPS
339\summary {Prevents collecting of imported targets during Android deployment.}
341\cmakevariablesince 6.5
342\preliminarycmakevariable
343\cmakevariableandroidonly
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.
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}
359\page cmake-variable-qt-host-path.html
360\ingroup cmake-variables-qtcore
363\target cmake-variable-QT_HOST_PATH
365\summary {Location of the host Qt installation when cross-compiling.}
367\cmakevariablesince 6.0
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).
375\page cmake-variable-qt-no-set-xcode-development-team-id.html
376\ingroup cmake-variables-qtcore
378\title QT_NO_SET_XCODE_DEVELOPMENT_TEAM_ID
379\target cmake-variable-QT_NO_SET_XCODE_DEVELOPMENT_TEAM_ID
381\summary {Disables providing a fallback team ID during target finalization on iOS.}
383\cmakevariablesince 6.1
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.
392\page cmake-variable-qt-no-set-xcode-bundle-identifier.html
393\ingroup cmake-variables-qtcore
395\title QT_NO_SET_XCODE_BUNDLE_IDENTIFIER
396\target cmake-variable-QT_NO_SET_XCODE_BUNDLE_IDENTIFIER
398\summary {Disables providing a fallback app bundle ID during target finalization on iOS.}
400\cmakevariablesince 6.1
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.
410\page cmake-variable-qt-enable-verbose-deployment.html
411\ingroup cmake-variables-qtcore
413\title QT_ENABLE_VERBOSE_DEPLOYMENT
414\target cmake-variable-QT_ENABLE_VERBOSE_DEPLOYMENT
416\summary {Enables verbose mode of deployment tools}
418\cmakevariablesince 6.3
419\preliminarycmakevariable
421Enables verbose mode of the \l androiddeployqt deployment tool when it is called
422internally at build time, usually during target finalization.
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.
430\page cmake-variable-qt-deploy-support.html
431\ingroup cmake-variables-qtcore
433\title QT_DEPLOY_SUPPORT
434\target cmake-variable-QT_DEPLOY_SUPPORT
436\summary {Name of the file to include for setting up deployment support.}
438\cmakevariablesince 6.3
439\preliminarycmakevariable
440\note The value of this variable should never be modified by project code.
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.
448The following example shows one way the variable would be used when installing
449an application, along with its runtime dependencies:
451\include cmake-deploy-modified-variable-values.qdocinc
453\sa {qt6_deploy_runtime_dependencies}{qt_deploy_runtime_dependencies()},
454 {qt6_deploy_qml_imports}{qt_deploy_qml_imports()}
458\page cmake-variable-qt-no-standard-project-setup.html
459\ingroup cmake-variables-qtcore
461\title QT_NO_STANDARD_PROJECT_SETUP
462\target cmake-variable-QT_NO_STANDARD_PROJECT_SETUP
464\summary {Prevents subsequent calls to qt_standard_project_setup() from making any changes.}
466\cmakevariablesince 6.3
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.
477\sa {qt6_standard_project_setup}{qt_standard_project_setup()}
481\page cmake-variable-qt-ios-launch-screen.html
482\ingroup cmake-variables-qtcore
484\title QT_IOS_LAUNCH_SCREEN
485\target cmake-variable-QT_IOS_LAUNCH_SCREEN
487\summary {Path to iOS launch screen storyboard used by all targets}
489\cmakevariablesince 6.4
490\preliminarycmakevariable
493Specifies the path to an iOS launch screen storyboard file that will be used
494by all targets within a project.
496\sa {Launch Screens and Launch Images}