【问题标题】:How does visual studio 2015 add "\Zi" compile option to CUDA Linker? How to remove it?Visual Studio 2015 如何为 CUDA Linker 添加“\Zi”编译选项?如何删除它?
【发布时间】:2021-01-03 06:29:17
【问题描述】:

我使用 cmake 来构建 C++ 项目。我没有在 CMAKE_CUDA_FLAGS 中添加“/Zi”编译选项。但是 Visual Studio 会自动将“/Zi”添加到 CUDA Linker。使用此选项,我的库会变得非常大,那么我该如何删除它?

【问题讨论】:

  • 好的,但是你的 CMake 文件是什么样的?
  • @drescherjm, /Zi 生成 .pdb 可用于展开堆栈跟踪。
  • \Zi 只是一个Debug Information Format。如果不需要调试信息,可以在Properties->C/C++->General->Debug Information Format中设置None

标签: c++ visual-studio cmake cuda


【解决方案1】:

CUDA Visual Studio 集成默认情况下不会使 /Zi 可配置。

您可以直接在C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\BuildCustomizations\CUDA 10.0.props 中修改HostCommandLineTemplateRuntimeApiCommandLineTemplateCommandLineTemplate,或者指定一个额外的.props 文件以根据Visual Studio Customize your build 自定义您的构建。

以防万一,Here 也是使用 cmake 自定义 VS 构建属性的示例。

【讨论】:

    猜你喜欢
    • 2016-12-03
    • 2021-01-04
    • 1970-01-01
    • 2011-04-26
    • 1970-01-01
    • 2020-04-10
    • 1970-01-01
    • 1970-01-01
    • 2023-03-11
    相关资源
    最近更新 更多