On this page

qt_set_harmonyos_app_metadata

Sets HarmonyOS application-level metadata on the target.

The command is defined in the Core component of the Qt6 package, which can be loaded like so:

find_package(Qt6 REQUIRED COMPONENTS Core)

This command was introduced in Qt 6.12.

Note: This command is in technology preview and may change in future releases.

Note: This command should only be called if targeting the HarmonyOS platform.

Synopsis

qt_set_harmonyos_app_metadata(target
    [VENDOR <string>]
    [VERSION_CODE <integer>]
    [VERSION_NAME <string>]
    [LABEL <label>]
    [ICON <icon>]
    [COMPATIBLE_SDK_VERSION <string>]
    [TARGET_SDK_VERSION <string>]
    [COMPILE_SDK_VERSION <string>]
)

If versionless commands are disabled, use qt6_set_harmonyos_app_metadata() instead. It supports the same set of arguments as this command.

Description

The command sets application-level metadata for the HarmonyOS target executable. The values are conceptually app-scoped (one application maps to one bundle) and are baked into AppScope/app.json5 and entry/build-profile.json5 when the HAP package is built. Module-scoped metadata, such as the description or orientation, is set with qt_set_harmonyos_module_metadata() instead.

Arguments

VENDOR is the name of the application vendor.

VERSION_CODE is the integer version code of the application. It is an internal version number that is not shown to the user.

VERSION_NAME is the human-readable version string of the application, for example 1.0.0.

LABEL is the application name shown to the user. It accepts either a literal string or a $string:<name> resource reference that resolves to a localized string from the application's resource files.

ICON is the application icon. It accepts either a path to an image file or a $media:<name> resource reference. A relative path is resolved against the CMAKE_CURRENT_SOURCE_DIR of the calling directory. When a file path is given, the image is copied into the bundle's media resources and a $media: reference is generated for it.

COMPATIBLE_SDK_VERSION, TARGET_SDK_VERSION, and COMPILE_SDK_VERSION set the corresponding SDK version fields in entry/build-profile.json5. The values are substituted verbatim, so they must use the format expected by the HarmonyOS toolchain, for example COMPATIBLE_SDK_VERSION "5.0.0(12)" and TARGET_SDK_VERSION "14".

An option that is not specified is not written to the manifest. The corresponding field then keeps the value defined by the package template, so the effective default for each option is whatever that template provides. See QT_HARMONYOS_PACKAGE_SOURCE_DIR for how to inspect or replace that template.

Example

qt_add_executable(myapp
    // ...
)
qt_set_harmonyos_app_metadata(myapp
    VENDOR "Example Inc."
    VERSION_CODE 1
    VERSION_NAME "1.0.0"
    LABEL "My Application"
    ICON "${CMAKE_CURRENT_SOURCE_DIR}/icon.png"
)

See also qt_set_harmonyos_module_metadata() and Qt for HarmonyOS CMake API.

© 2026 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.