最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin1浏览0评论

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

发布评论

评论列表(0)

  1. 暂无评论