qt_disable_unicode_defines
防止在目标上自动设置某些与 Unicode 相关的编译器定义。
该命令定义在Qt6 包的Core 组件中,可按以下方式加载:
find_package(Qt6 REQUIRED COMPONENTS Core)该命令于 Qt 6.2 版本中引入。
语法
qt_disable_unicode_defines(target)如果无版本号的命令被禁用,请改用qt6_disable_unicode_defines() 。它支持与本命令相同的参数集。
说明
在 Qt 6 中,对于链接 Qt 模块的目标,默认会设置UNICODE 和_UNICODE 编译器定义。这与 qmake 的行为一致,但与 Qt 5 中 CMake API 的行为相比有所变化。在target 上调用qt_disable_unicode_defines() 可防止这些编译器定义被自动设置。
© 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.