如何用cmake设置GDB调试标志? [英] How do you set GDB debug flag with cmake?

查看:1030
本文介绍了如何用cmake设置GDB调试标志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用

设置调试标志。

  set 
pre>

命令在 cmake ,但我不知道要添加什么。我被告知像 DEBUG = true 的东西,但到目前为止我无法找到正确的标志设置。

解决方案

如果要在编译时构建调试(包括源代码信息,即-g),请使用

  cmake -DCMAKE_BUILD_TYPE = Debug< path> 

如果要构建发布版本,可以使用

  cmake -DCMAKE_BUILD_TYPE = RelWithDebInfo< path> 


I have tried setting the debug flags using the

set

command in cmake but I cam unsure what to add. I have been told things like DEBUG=true but so far i am unable to find the correct flag to set.

解决方案

If you want to build for debug (including source information, i.e. -g) when compiling, use

cmake -DCMAKE_BUILD_TYPE=Debug <path>

If you want to build a release build, you can use

cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo <path>

这篇关于如何用cmake设置GDB调试标志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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