防止强制将源文件视为 UTF-8 for Windows。
命令的定义在
核心
组件对于
Qt6
包,可以像这样加载:
find_package(Qt6 REQUIRED COMPONENTS Core)
该命令在 Qt 6.0 引入。
qt_allow_non_utf8_sources(target)
若
无版本命令
被禁用,使用
qt6_allow_non_utf8_sources()
代替。它支持如此命令的一组相同自变量。
When building with some compilers for Windows, targets that link to a Qt library will use flags that force the compiler to treat its source files as UTF-8. This is currently implemented for Visual Studio and Intel compilers. You can disable this behavior on a per-target basis by calling
qt_allow_non_utf8_sources()
and passing the target as the argument.
另请参阅 qt_disable_unicode_defines() .