CMake Variable Reference
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:
Variable | Description |
---|---|
Qt6Widgets_COMPILE_DEFINITIONS | A list of compile definitions to use when building against the library. |
Qt6Widgets_DEFINITIONS | A list of definitions to use when building against the library. |
Qt6Widgets_EXECUTABLE_COMPILE_FLAGS | A string of flags to use when building executables against the library. |
Qt6Widgets_FOUND | A boolean that describes whether the module was found successfully. |
Qt6Widgets_INCLUDE_DIRS | A list of include directories to use when building against the library. |
Qt6Widgets_LIBRARIES | The name of the imported target for the module: Qt5::Widgets |
Qt6Widgets_PRIVATE_INCLUDE_DIRS | A list of private include directories to use when building against the library and using private Qt API. |
Qt6Widgets_VERSION_STRING | A 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.
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-specific architecture of the host system | |
Location of the Android SDK | |
List of arguments to pass to Android applications | |
Location of the host Qt installation when cross-compiling |