Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cmake VSCode任务依赖于正在运行的任务,而不是任务本身_Cmake_Vscode Tasks - Fatal编程技术网

Cmake VSCode任务依赖于正在运行的任务,而不是任务本身

Cmake VSCode任务依赖于正在运行的任务,而不是任务本身,cmake,vscode-tasks,Cmake,Vscode Tasks,我的tasks.json中有2个任务。第一个是运行正确的CMAKE。第二个是make,它取决于首先运行的CMAKE。当我使用dependsOn cmake选项并运行任务make时,它只运行cmake任务,之后不运行make任务 { "version": "2.0.0", "command": "sh", "args": [ "-c" ], "presentation": { "echo": true, "re

我的tasks.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.
正在执行任务:sh-c'cmake-DCMAKE\u BUILD\u TYPE=Debug..'<
--配置完成
--生成完成
--生成文件已写入:/home/gertjan/multiply/Build
按任意键关闭终端。

很明显,这与我任务中最重要的sh-c有关。我还将任务中的参数更改为command。我的结果tasks.json文件:

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

这显然与我任务的顶端的sh-c有关。我还将任务中的参数更改为command。我的结果tasks.json文件:

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