qt_add_binary_resources
从 Qt 资源文件列表中创建 RCC 文件。
该命令在Qt6
软件包的Core
组件中定义,可以像这样加载:
find_package(Qt6 REQUIRED COMPONENTS Core)
该命令在 Qt 5.10 中引入。
简介
qt_add_binary_resources(target file1.qrc [file2.qrc ...] [DESTINATION ...] [OPTIONS ...])
如果禁用了无版本命令,请使用qt6_add_binary_resources()
代替。它支持与此命令相同的参数集。
说明
添加自定义target
,将 Qt Resource Compiler 编译成二进制.rcc
文件。
参数
DESTINATION
设置生成的 文件的路径。默认路径为 。.rcc
${CMAKE_CURRENT_BINARY_DIR}/${target}.rcc
您可以设置应添加到rcc
调用的其他OPTIONS
。您可以在rcc 文档中找到可能的选项。
示例
qt_add_binary_resources(resources project.qrc OPTIONS -no-compress) add_dependencies(myapp resources)
© 2025 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.