Qt for HarmonyOS CMake API
Note: The HarmonyOS CMake API is in technology preview and may change in future releases.
This page lists the CMake commands, target properties, and variables that configure how a Qt application is packaged into a HarmonyOS Ability Package (HAP).
When you create a Qt executable with qt_add_executable() while targeting HarmonyOS, Qt automatically generates a <target>_make_hap build target that produces the HAP. The commands, properties, and variables below control the contents of that HAP and the metadata written into the HarmonyOS manifest files.
A HarmonyOS application bundle is described by two kinds of manifest: the application-level app.json5, which holds metadata that applies to the whole bundle, and the module-level module.json5, which describes a single HAP module within that bundle. The target properties below mirror this split: the QT_HARMONYOS_APP_* properties set application-level metadata, such as the vendor, version, label, and icon, while properties such as QT_HARMONYOS_MODULE_DESCRIPTION and QT_HARMONYOS_ABILITY_ORIENTATION set module-level metadata. See the Target Properties section below for the full list.
Commands
- qt_add_harmonyos_permission() adds a HarmonyOS permission to the application.
Target Properties
The following target properties affect how the HAP is built:
The screen-orientation policy of the HarmonyOS ability. | |
The HarmonyOS application's bundle name. | |
The HarmonyOS application's icon. | |
The HarmonyOS application's label. | |
The HarmonyOS application's name. | |
The HarmonyOS application's vendor. | |
The HarmonyOS application's version code. | |
The HarmonyOS application's version name. | |
The HarmonyOS application's compatible SDK version. | |
The HarmonyOS application's compile SDK version. | |
Extra libraries to deploy with the HarmonyOS target. | |
Extra Qt plugins to deploy with the HarmonyOS target. | |
The HarmonyOS module's description. | |
The device types supported by the HarmonyOS module. | |
Path to a custom HarmonyOS package template. | |
The target architectures of the HarmonyOS application. | |
The HarmonyOS application's target SDK version. |
Variables
The following variables affect how the HAP is built: