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

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

问题描述

我尝试使用

set

cmake 中的命令,但我不确定要添加什么.有人告诉我诸如 DEBUG=true 之类的事情,但到目前为止我无法找到要设置的正确标志.

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.

推荐答案

如果你想在编译时为 debug 构建(包括源信息,即 -g),使用

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天全站免登陆