Enable debug symbols for CMAKE in VS2017

Viewed 2132

Visual Studio 2017 supports built-in cmake features, I don't need to work with solution or project files anymore.

When I tried to build and debug an executable program, the output window said:

Module was built without symbols.

I couldn't set breakpoints in code. This is the debug flags set by cmake:

message(STATUS ${CMAKE_CXX_FLAGS_DEBUG})
/MDd /Zi /Ob0 /Od /RTC1

How can I add debug symbols in VS2017.2 (the version that uses cmake 3.7.2)?

EDIT: my settings for x86-Debug:

{
    "name": "x86-Debug",
    "generator": "Visual Studio 15 2017",
    "configurationType": "Debug",
    "buildRoot": "${env.LOCALAPPDATA}\\CMakeBuild\\${workspaceHash}\\build\\${name}",
    "cmakeCommandArgs": "",
    "buildCommandArgs": "-m -v:minimal",
    "ctestCommandArgs": "",
    "variables": [
        {
            "name": "BUILD_SHARED_LIBS",
            "value": "OFF"
        }
    ]
}
0 Answers
Related