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 metadata commands below mirror this split, so there is one command for each scope.
Commands
- qt_set_harmonyos_app_metadata() sets application-level metadata, such as the vendor, version, label, and icon.
- qt_set_harmonyos_module_metadata() sets module-level metadata, such as the description, device types, and orientation.
- qt_add_harmonyos_permission() adds a HarmonyOS permission to the application.
Target Properties
The following target properties affect how the HAP is built:
The HarmonyOS application's bundle name. | |
The HarmonyOS application's name. | |
Extra libraries to deploy with the HarmonyOS target. | |
Extra Qt plugins to deploy with the HarmonyOS target. | |
Path to the hvigor wrapper used to build the HAP. | |
Path to a custom HarmonyOS package template. | |
The target architectures of the HarmonyOS application. |
Variables
The following variables affect how the HAP is built:
Path to the hvigor wrapper used to build HAP packages. |