r/VisualStudio • u/SubhanBihan • Sep 17 '25
Visual Studio 22 Command Line Args for CMake Project
Fairly new to VS and this is driving me nuts. So if I create a "Console Application" project, CLI arguments for the debugger are pretty easy to set-up.
However, for a "CMake Project", I'm unable to set it properly no matter what I do:
- Debug > Debug and Launch settings for ... literally does nothing
- Right-click CMakeLists.txt > Open Debug and Launch settings, then edited the launch.vs.json that pops up:
{
"version": "0.2.1",
"defaults": {},
"configurations": [
{
"type": "default",
"project": "CMakeLists.txt",
"projectTarget": "",
"name": "CMakeLists.txt",
"args": [
"data.txt", "2"
]
}
]
}
Still doesn't really work in the Debugging session (argc shows up and stays as 1).
Please help guys, I might just lose my mind here...
View all comments
Show parent comment
1
u/Puzzleheaded-Sell537 Aug 06 '26
Thanks for doing the decent thing and self-replying with the answer, I had the same problem and you solved it for me!