【发布时间】:2020-03-02 15:04:05
【问题描述】:
我想设置 VScode,以便我可以使用构建任务来构建我的项目。该项目是使用make构建的,我已经定义了一个运行make的构建任务。但是,在运行 make 之前,我通常会获取一个正确设置环境变量的脚本。如果我使用 source 命令添加新的构建任务,并将我的主要构建任务设置为首先执行 source 命令,则环境变量不会正确传播。如何确保在构建任务之间保留环境变量?
我的 tasks.json 文件:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "make",
"command": "make",
"args": [],
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"dependsOn": "Set environment"
},
{
"label": "Set environment",
"type": "shell",
"command": "source path/to/source_me.sh",
"group": "build",
]
}
【问题讨论】:
标签: visual-studio-code environment-variables gnu-make