CMake 删除“诊断中源代码文件的完整路径"选项/FC [英] CMake remove "Full Path of Source Code File in Diagnostics" option /FC

查看:24
本文介绍了CMake 删除“诊断中源代码文件的完整路径"选项/FC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 CMakeLists.txt 中指示 CMake 创建不包含/FP 的 Visual Studio 项目 选项?

How can I instruct CMake in the CMakeLists.txt to create a Visual Studio project that does not contain the /FP option?

谢谢

推荐答案

TL;DR:目前这似乎是不可能的.您可以提交错误报告CMake 问题跟踪器.

TL;DR: This seems to be impossible, at the moment. You may file a bug report on the CMake Issue Tracker.

诊断中源代码文件的完整路径"的默认设置似乎已启用.在 Visual Studio 中,如果打开项目的属性并导航到 Configuration Properties ->C/C++ ->高级,你会发现使用完整路径"属性,它是启用的.您可能还认识到它以非粗体字体打印,表示默认值.将其设置为否",它会变为粗体.

The default setting for "Full Path of Source Code File in Diagnostics" seems to be set to enabled. In Visual Studio, if you open the project's properties and navigate to Configuration Properties -> C/C++ -> Advanced, you will find the "Use Full Paths" property, which is enabled. You may also recognize that it is printed in a non-bold font, indicating a default value. Set it to "no" and it turns bold.

保存项目将在 .vcxproj 文件中添加一行:

Saving the project will add a line to the <project>.vcxproj file:

[...]
<ClCompile>
    [...]
    <UseFullPaths>false</UseFullPaths>
</ClCompile>
[...]

显然,CMake 需要添加这一行来显式禁用编译标志.但是,从 搜索存储库,我们了解到目前没有实现来实现这一点.FC 标志被映射为空或 true:

Obviously, CMake needs to add this line to explicitly disable the compile flag. However, from a search of the repository, we learn that there is currently no implementation to achieve this. The FC flag is mapped to nothing or to true:

[...]
{ "UseFullPaths", "FC", "", "true", 0 },
[...]

记住,两种方式都表示打开诊断中源代码文件的完整路径".

Remember, both ways indicate to turn on "Full Path of Source Code File in Diagnostics".

总结:CMake 中没有允许显式禁用此标志的实现.您必须编写一个后期处理脚本来相应地更改 .vcxproj 文件.

To Conclude: There is no implementation in CMake, which allows to explicitly disable this flag. You have to write a post process script to change the <project>.vcxproj file accordingly.

这篇关于CMake 删除“诊断中源代码文件的完整路径"选项/FC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆