c++ - 如何阻止 `/Gm-` 从 CMake 传递给 clang_cl.exe

标签 c++ cmake clang compiler-warnings

我正在使用 clang 在 Windows 上构建一个 C++ 项目,并使用 CMake 生成该项目。我正在通过 Visual Studio/MSBuild 执行此操作。我已经为桌面(x86、x64)安装了 LLVM 和 VC++ 2015.3 v140 工具集。

要生成项目并构建我这样做:

mkdir build
cd build
cmake .. -G "Visual Studio 15 2017 Win64" -TLLVM-vs2014
cmake --build .

当我构建时,我收到此警告:

clang-cl.exe : warning : argument unused during compilation: '/Gm-' [-Wunused-command-line-argument]

当我打印 ${CMAKE_CXX_FLAGS} 时,我得到:

/DWIN32 -fms-extensions -fms-compatibility -D_WINDOWS -frtti -fexceptions -Wall -Wextra -Wno-long-long -Wno-missing-braces

但我没有看到 -/Gm 被插入到哪里,也没有看到如何删除它。

有人遇到过这种情况吗?

感谢您的帮助!

汤姆

最佳答案

这听起来像是一个 Visual Studio 错误 - 他们支持 clang 还为时过早。

我认为你应该在这里做正确的事 report this . Microsoft 似乎正在真正努力变得更加开放 - 在这个词的两种意义上 - 如果我们想要一个好的产品,我们应该努力帮助他们。

我会关注那些反对票......

关于c++ - 如何阻止 `/Gm-` 从 CMake 传递给 clang_cl.exe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50883851/

相关文章:

compiler-construction - clang 和 clang-mp-3.3(3.2 或 3.4)有什么区别?

c# - 可能由 Nuget 包引起的 Visual Studio 2013 错误?

c++ - 我正在尝试将像素数据转换为 OpenCV Mat 对象

c++ - 'make_unique' 不是 'std' 的成员

铿锵工具。键入名称不带关键字

c - 直接在汇编中使用 stdlib.h 函数

c++ - 跟踪句柄创建/删除

c++ - 在 OpenGL 中哪种渲染对象的方式更有效?

c++ - Ubuntu 上的 Cmake 可执行文件在哪里

Linux 上的 CMake : "target platform does not support dynamic linking"