我有一个用于VSCode的cmake项目,有几个构建变体。
也就是说,我将cmake-variants.json定义为:
{
"buildType": {
"default": "Debug",
"description": "The build type",
"choices": {
"Debug": {
"short": "Debug",
"long": "Debug: with debug info",
"buildType": "Debug"
},
"Release": {
"short": "Release",
"long": "Release: no debug info",
"buildType": "Release"
},
...
}
},
"buildVariant": {
"default": "gcc-a64",
"description": "Build variant (host or cross-compiling with GCC or Clang)",
"choices": {
"gcc-a64": {
"short": "gcc-a64",
"long": "GCCg cross-compile for A64",
},
....
}
}
}然后在settings.json中,我使用变量扩展定义了cmake构建目录,如下所示:
"C_Cpp.default.configurationProvider": "vector-of-bool.cmake-tools",
"cmake.buildDirectory": "${workspaceFolder}/build/${variant:buildVariant}-${buildType}"
"cmake.generator": "Ninja",
...但是现在对于远程调试,我需要可执行文件的路径在launch.json中可用(即构建工件的路径):
"configurations": [
{
"name": "(cross-gdb) Launch program",
"type": "cppdbg",
"request": "launch",
"program": "/path/to/cmake/build/directory/program",
...
}看起来launch.json并不知道"cmake.buildDirectory":它只知道"${workspaceFolder}“。有没有办法告诉launch json构建工件应该放在哪里?
发布于 2020-07-21 21:25:16
我自己找到的:
"program": "${command:cmake.launchTargetDirectory}/program"https://vector-of-bool.github.io/docs/vscode-cmake-tools/debugging.html
https://stackoverflow.com/questions/63015200
复制相似问题