{ "version": "2.0.0", "options": { "cwd": "${workspaceRoot}/build" }, // 指定命令执行所在路径 "tasks": [ { "label": "cmake", "type": "shell", "command": "cmake", "args": [ // "-DBUILD_SHARED_LIBS=OFF", // "-Dgtest_build_samples=ON", "..", "-DCMAKE_BUILD_TYPE=Debug", // "-DCMAKE_BUILD_TYPE=Release", // "-DCMAKE_EXPORT_COMPILE_COMMANDS=1", // 这是生成compile_commands.json文件的选项 ] }, { "label": "g++ build active file", // 要执行的第二个make命令 "type": "shell", "command": "make unit_test", "args": [], "group": { "kind": "build", "isDefault": true }, "dependsOn": [ "cmake" ] ///指定,在执行make之前,需先执行cmake }, ] }