小编Imm*_*mac的帖子

如何使用任务在 Visual Studio Code 中运行 Cmake

我正在尝试ctrl+shift+B像这样运行 cmake :

{
"version": "2.0.0",
"tasks": [
    {
        "label": "cmake",
        "type": "shell",
        "options": {
            "cwd": "${workspaceRoot}/build"
        },
        "command": "cmake ${workspaceRoot} -G \"MinGW Makefiles\"",
        (...)
    },
    {
        "label": "make",
        "type": "shell",
        "command": "mingw32-make.exe",
        "options": {
            "cwd": "${workspaceRoot}/build"
        },
       (...),
        "dependsOn":["cmake"]
    },
    {
        "label": "build",
        "type": "shell",
        "options": {
            "cwd": "${workspaceRoot}/build"
        },
        "group": {
            "kind": "build",
            "isDefault": true
        },
        "dependsOn": ["make"]
    }
]
}
Run Code Online (Sandbox Code Playgroud)

但无论我做什么,它都运行在 ${workspaceRoot} 而不是 ${workspaceRoot}/build 上:

Executing task in folder cpppractice: cmake C:\workspace\cpp\cpppractice -G "MinGW Makefiles" …
Run Code Online (Sandbox Code Playgroud)

c++ cmake visual-studio-code vscode-tasks

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

c++ ×1

cmake ×1

visual-studio-code ×1

vscode-tasks ×1