QT_HARMONYOS_EXTRA_PLUGINS

与 HarmonyOS 目标一起部署的额外 Qt 插件。

该属性于 Qt 6.12 版本中引入。

注意:此 属性处于技术预览阶段,未来版本中可能会发生变化。

注意: 仅当目标平台为 HarmonyOS 时,才使用此 属性。

要打包到 HAP 中的其他 Qt 插件列表。此选项适用于无法自动检测的插件,例如仅在运行时加载的插件。

列表中的每一项要么是 CMake 插件目标的名称(该名称将被解析为插件的库文件),要么是插件库的绝对路径。插件在 HAP 中的分类由插件库父目录的名称决定,例如imageformats 。

set_target_properties(myapp PROPERTIES
    QT_HARMONYOS_EXTRA_PLUGINS
        "${CMAKE_CURRENT_BINARY_DIR}/imageformats/libqcustomimg.so"
)

此属性适用于 Qt 插件,这些插件会被放置在其类别目录中,并由 Qt 的插件系统加载。若要部署普通共享库(这些库被放置在 HAP 的库目录中,并由动态链接器解析),请改用QT_HARMONYOS_EXTRA_LIBS。

当添加作为项目组成部分构建的插件时,还需添加一个构建依赖项,以确保在目标部署之前该插件已可用:

add_dependencies(myapp qcustomimg)

另请参阅 QT_HARMONYOS_EXTRA_LIBS。

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