visual studio code - Change C_Cpp.ConfigurationSelect via tasks.json - Stack Overflow

I currently have a tasks.json task which does a CMake debug build via terminal commands:"label&quo

I currently have a tasks.json task which does a CMake debug build via terminal commands:

 "label": "LCD",
 "type": "shell",
 "command": "cmake -S . -B ./cmake/dbg -DCMAKE_BUILD_TYPE=Debug; cmake --build ./cmake/dbg --config Debug",

For release builds, I have a different task:

 "label": "LCR",
 "type": "shell",
 "command": "cmake -S . -B ./cmake/rel -DCMAKE_BUILD_TYPE=Release; cmake --build ./cmake/rel --config Release"

Corresponding to a debug or release code that I am working on/going to run, I have corresponding configurations in c_cpp_properties.json

{
    "name": "LCD",
    "compileCommands": "${workspaceFolder}/cmake/dbg/compile_commands.json"
},
{
    "name": "LCR",
    "compileCommands": "${workspaceFolder}/cmake/rel/compile_commands.json"
}

Currently, I manually choose either of these configurations (via VSCode command C_Cpp.ConfigurationSelect so that the correct compile_commands.json can be used for intellisense/highlighting of code, etc.

Is there a way to pass the VSCode command of having the LCD configuration be selected automatically when task LCD is run?

XPost in vscode-cpptools

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745153965a4614005.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信