CMake Variable Reference

Qt build variables

When building Qt you can use CMake variables to control the build result.

VariableDescription
QT_HOST_PATHLocation of the host Qt installation from which host tools may be used during another Qt build, either a regular one or a cross-compiling one.
QT_FORCE_BUILD_TOOLSForces building tools even if host tools have already been found. Useful when cross-compiling Qt to ensure the SDK has cross-built tools.
QT_FORCE_FIND_TOOLSUses Qt tools from the pre-built Qt in QT_HOST_PATH when you do not cross-compile. The variable only takes effect if QT_FORCE_BUILD_TOOLS is set to ON. Otherwise QT_FORCE_FIND_TOOLS does not affect the default behavior.

Module variables

Qt modules loaded with find_package set various variables.

Note: You rarely need to access these variables directly. Common tasks like linking against a module should be done through the library targets each module defines.

For example, find_package(Qt6 COMPONENTS Widgets), when successful, makes the following variables available:

VariableDescription
Qt6Widgets_COMPILE_DEFINITIONSA list of compile definitions to use when building against the library.
Qt6Widgets_DEFINITIONSA list of definitions to use when building against the library.
Qt6Widgets_EXECUTABLE_COMPILE_FLAGSA string of flags to use when building executables against the library.
Qt6Widgets_FOUNDA boolean that describes whether the module was found successfully.
Qt6Widgets_INCLUDE_DIRSA list of include directories to use when building against the library.
Qt6Widgets_LIBRARIESThe name of the imported target for the module: Qt6::Widgets
Qt6Widgets_PRIVATE_INCLUDE_DIRSA list of private include directories to use when building against the library and using private Qt API.
Qt6Widgets_VERSIONA string containing the module's version.

For all packages found with find_package, equivalents of these variables are available; they are case-sensitive.

Installation variables

Additionally, there are also variables that don't relate to a particular package, but to the Qt installation itself.

VariableDescription

QT_DEFAULT_MAJOR_VERSION

An integer that controls the Qt version that qt_ commands forward to in case of mixed Qt 5 and Qt 6 projects. It needs to be set to either 5 or 6 before the respective find_package() calls.

If set to 5, commands starting with qt_ will call their counterpart starting with qt5_. If set to 6, they will call their counterpart starting with qt6_.

If not set, the first find_package call defines the default version.

QT_LIBINFIXA string that holds the infix used in library names, when Qt is configured with -libinfix.

QT_NO_CREATE_VERSIONLESS_FUNCTIONS

Hides commands that start with qt_, leaving only the versioned ones starting with qt6_.

QT_NO_CREATE_VERSIONLESS_TARGETS

Hides the imported targets starting with Qt::. Instead, you need to use the targets starting with Qt6::.
QT_VISIBILITY_AVAILABLEOn Unix, a boolean that describes whether Qt libraries and plugins were compiled with -fvisibility=hidden. This means that only selected symbols are exported.

Project variables

These variables can influence CMake commands provided by Qt. They may be set by the project, a toolchain file or other third-party packages.

Qt6::Core

ANDROID_NDK_HOST_SYSTEM_NAME

Android-specific architecture of the host system

ANDROID_SDK_ROOT

Location of the Android SDK

QT_ANDROID_ABIS

List of ABIs that the project packages are built for

QT_ANDROID_APPLICATION_ARGUMENTS

List of arguments to pass to Android applications

QT_ANDROID_BUILD_ALL_ABIS

Enables building multi-ABI packages using the autodetected Qt for Android SDK list

QT_ANDROID_DEPLOYMENT_TYPE

Forces or disables release package signing regardless of the build type

QT_ANDROID_MULTI_ABI_FORWARD_VARS

Allows to share CMake variables in multi-ABI builds

QT_ANDROID_SIGN_AAB

Signs the .aab package with the specified keystore, alias, and store password

QT_ANDROID_SIGN_APK

Signs the package with the specified keystore, alias, and store password

QT_DEPLOY_BIN_DIR

Prefix-relative subdirectory for deploying runtime binaries on some target platforms

QT_DEPLOY_IGNORED_LIB_DIRS

Directories that are excluded from runtime dependencies search

QT_DEPLOY_LIBEXEC_DIR

Prefix-relative subdirectory for deploying program executables on some target platforms

QT_DEPLOY_LIB_DIR

Prefix-relative subdirectory for deploying libraries on some target platforms

QT_DEPLOY_PLUGINS_DIR

Prefix-relative subdirectory for deploying Qt plugins on some target platforms

QT_DEPLOY_PREFIX

Base location for a deployment

QT_DEPLOY_QML_DIR

Prefix-relative subdirectory for deploying QML plugins on some target platforms

QT_DEPLOY_SUPPORT

Name of the file to include for setting up deployment support

QT_DEPLOY_TRANSLATIONS_DIR

Prefix-relative subdirectory for deploying Qt translations on some target platforms

QT_ENABLE_VERBOSE_DEPLOYMENT

Enables verbose mode of deployment tools

QT_HOST_PATH

Location of the host Qt installation when cross-compiling

QT_I18N_SOURCE_LANGUAGE

Specifies the language of translatable strings

QT_I18N_TRANSLATED_LANGUAGES

List of languages to be used for project internationalization

QT_IOS_LAUNCH_SCREEN

Path to iOS launch screen storyboard used by all targets

QT_NO_COLLECT_BUILD_TREE_APK_DEPS

Prevents collecting of project-built shared library targets during Android deployment

QT_NO_COLLECT_IMPORTED_TARGET_APK_DEPS

Prevents collecting of imported targets during Android deployment

QT_NO_SET_XCODE_BUNDLE_IDENTIFIER

Disables providing a fallback app bundle ID during target finalization on iOS

QT_NO_SET_XCODE_DEVELOPMENT_TEAM_ID

Disables providing a fallback team ID during target finalization on iOS

QT_NO_STANDARD_PROJECT_SETUP

Prevents subsequent calls to qt_standard_project_setup() from making any changes

QT_PATH_ANDROID_ABI_<ABI>

Set of variables to specify the path to Qt for Android for the corresponding ABI

Qt6::Qml

QT_QML_GENERATE_QMLLS_INI

Enables autogeneration of .qmlls.ini files for QML Language Server

QT_QML_OUTPUT_DIRECTORY

Base output directory below which QML modules will be created by default

Qt6::InterfaceFramework

IFCODEGEN_VERBOSE

Enable verbose logging for all ifcodegen functions

QT_IFCODEGEN_TEMPLATE_SEARCH_PATH

Search path for ifcodegen templates

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.