CMake构建模式RelWithDebInfo [英] CMake build mode RelWithDebInfo

查看:1008
本文介绍了CMake构建模式RelWithDebInfo的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为我了解Release和Debug构建模式之间的区别.主要区别在于,在调试"模式下,生成的可执行文件未经过优化(因为这会使调试更加困难),并且其中包含调试符号.

I think that I understand the difference between Release and Debug build modes. The main differences being that in Debug mode, the executable produced isn't optimized (as this could make debugging harder) and the debug symbols are included.

在构建PCRE(WinMerge的外部依赖项之一)的同时,我注意到以前从未见过的构建模式:RelWithDebInfo.

While building PCRE, one of the external dependencies for WinMerge, I noticed a build mode that I hadn't seen before: RelWithDebInfo.

此处提到了Debug和RelWithDebInfo之间的区别: http://www.cmake.org/pipermail/cmake/2001-October/002479.html . 摘录: "RelwithDebInfo与发布模式非常相似.它可以生成完全优化的代码,但还可以构建程序数据库,并插入调试行信息,以便调试器有很大的机会随时猜测代码在哪里."

The difference between Debug and RelWithDebInfo is mentioned here: http://www.cmake.org/pipermail/cmake/2001-October/002479.html. exerpt: "RelwithDebInfo is quite similar to Release mode. It produces fully optimized code, but also builds the program database, and inserts debug line information to give a debugger a good chance at guessing where in the code you are at any time."

这听起来像是一个很好的主意,但是不一定很明显如何设置.此链接描述了如何为VC ++启用此功能: http://www.cygnus-software.com/papers/release_debugging.html

This sounds like a really good idea, however not necessarily obvious how to set up. This link describes how to enable this for VC++: http://www.cygnus-software.com/papers/release_debugging.html

我是否缺少某些内容,或者将所有发布代码编译为RelWithDebInfo没有意义吗?

Am I missing something, or does it not make sense to compile all release code as RelWithDebInfo?

推荐答案

我错过了什么吗? 编译所有发布代码很有意义 作为RelWithDebInfo?

Am I missing something, or does it not make sense to compile all release code as RelWithDebInfo?

这取决于您对客户对调试信息的信任程度.

It depends on how much you trust your customer with the debugging information.

其他信息:

gcc将调试信息编码为目标代码.

gcc encodes the debugging information into the object code.

这是gcc的pdb等效项:

Here is the pdb equivalent for gcc:

如何在构建之外生成gcc调试符号目标?

请注意,cmake似乎不支持这种方法.

Note, that cmake doesn't appear to support this approach out of the box.

这篇关于CMake构建模式RelWithDebInfo的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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