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() 可防止自动设置这些编译器定义。

另请参阅 qt_allow_non_utf8_sources()

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