QT_HARMONYOS_EXTRA_LIBS
与 HarmonyOS 目标一同部署的额外库。
该属性自 Qt 6.12 起引入。
注意:该 属性目前处于技术预览阶段,未来版本中可能会发生变化。
注意: 仅当目标平台为 HarmonyOS 时,才使用此 属性。
包含打包到 HAP 中的外部共享库列表,以便动态链接器在运行时能够找到它们。请将其用于无法被自动检测为应用程序依赖项的库。
列表中的每一项要么是 CMake 目标的名称(该名称将解析为目标的输出文件),要么是文件路径,要么是计算结果为该路径的生成器表达式。
set_target_properties(myapp PROPERTIES
QT_HARMONYOS_EXTRA_LIBS
"MyService;${CMAKE_CURRENT_BINARY_DIR}/libOther.so"
)目标直接链接的共享库会自动被收集,无需在此处列出。
在添加作为项目组成部分构建的库时,还应添加一个构建依赖项,以确保在目标部署之前该库已可用:
add_dependencies(myapp MyService)此属性适用于普通共享库。这些库将放置在 HAP 的库目录中,并由动态链接器进行解析。若要部署 Qt 插件(这些插件将放置在其所属的类别目录中,并由 Qt 的插件系统加载),请改用QT_HARMONYOS_EXTRA_PLUGINS。
© 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.