Vscode-cmake-tools: Passing command line arguments to a debug target

Created on 28 Feb 2017  路  9Comments  路  Source: microsoft/vscode-cmake-tools

To would be nice to have an option to pass command line arguments to a debug target which is selected in CMakeTools and launched on Ctrl+F5

more info needed question

Most helpful comment

JFTR: I was able to pass arguments to a debug target using cmake.debugConfig adding a settings.json file inside .vscode folder with this content:

{
    "cmake.debugConfig": {
        "args": [
            "myFirstArgument"
        ]
    }
}

All 9 comments

It seems like the cmake.debugConfig setting entry is broken, as VSCode offers no help regarding its existence. I've noticed this in the past few days, but options _should_ be settable using that config option. I'll have to play around and see why it isn't working. Until then, you can try setting cmake.debugConfig without any VSCode help. See this doc.

Are you unable to see cmake.debugConfig in the latest release?

Also, see the release notes regarding cmake.debugTargetProgramPath, which may be better suited for what you need.

Were you able to find a workable solution?

JFTR: I was able to pass arguments to a debug target using cmake.debugConfig adding a settings.json file inside .vscode folder with this content:

{
    "cmake.debugConfig": {
        "args": [
            "myFirstArgument"
        ]
    }
}

Closed.
If this issues still persists in the current _0.11.0-beta4_, feel free to reopen this one or create a new one.

JFTR: I was able to pass arguments to a debug target using cmake.debugConfig adding a settings.json file inside .vscode folder with this content:

{
    "cmake.debugConfig": {
        "args": [
            "myFirstArgument"
        ]
    }
}

Thx, That's work for me.

JFTR: I was able to pass arguments to a debug target using cmake.debugConfig adding a settings.json file inside .vscode folder with this content:

{
    "cmake.debugConfig": {
        "args": [
            "myFirstArgument"
        ]
    }
}

it works for me. but how do this when run without debugger ? I read cmake-tools , but it doesn't works for me, pass of args fails.

hello, why setting "args" in launch.json not working?

@liwei46, launch.json is not consumed by the CMake Tools debugging or running feature, but by F5. Are you F5-ing and your binary is not receiving the args defined in launch.json?
To use arguments via the cmake.Debug command (same as status bar debug icon), define in settings cmake.debugConfig.args as 2 comments above.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BarrettLowe picture BarrettLowe  路  4Comments

j-m picture j-m  路  5Comments

gabyx picture gabyx  路  5Comments

bobbrow picture bobbrow  路  4Comments

decimad picture decimad  路  6Comments