How do you set GDB debug flag with cmake?

后端 未结 2 1596
失恋的感觉
失恋的感觉 2020-12-12 19:31

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

相关标签:
2条回答
  • 2020-12-12 19:55

    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>
    
    0 讨论(0)
  • 2020-12-12 20:02

    Alternatively you can use the CMAKE GUI to make this change. Doing ccmake with the project will yield a screen similar to this:

    Entering Debug in the CMAKE_BUILD_TYPE field will allow you to build with debug flags.

    0 讨论(0)
提交回复
热议问题