VSCode任务取决于运行,任务本身不运行

时间:2019-08-09 20:31:26

标签: cmake vscode-tasks

我的task.json中有2个任务。第一个是正确运行的CMAKE。第二个是make,它取决于首先运行的CMAKE。当我使用选项dependsOn cmake并运行make任务时,它仅运行cmake任务,之后不运行make任务。

{
    "version": "2.0.0",
    "command": "sh",
    "args": [
        "-c"
    ],
    "presentation": {
        "echo": true,
        "reveal": "always",
        "focus": true,
        "panel": "new"
    },
    "tasks": [
        {
            "label": "cmake",
            "type": "shell",
            "options": {
                "cwd": "${workspaceRoot}/build"
            },
            "args": [
                "cmake -DCMAKE_BUILD_TYPE=Debug .."
            ]
        },
        {
            "label": "make",
            "type": "shell",
            "args": [
                "make -j8"
            ],
            "options": {
                "cwd": "${workspaceRoot}/build"
            },
            "dependsOn": [
                "cmake"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "problemMatcher": [
                "$gcc"
            ]
        }
    ]
}

已执行的make任务的输出:

Executing task: sh -c 'cmake -DCMAKE_BUILD_TYPE=Debug ..' <

-- Configuring done
-- Generating done
-- Build files have been written to: /home/gertjan/multiply/build

Press any key to close the terminal.

1 个答案:

答案 0 :(得分:0)

显然,这与我的任务顶部的sh -c有关。我也将args更改为任务中的命令。我生成的task.json文件:

NULL