3

I have c_cpp_properties.json, launch.json, and tasks.json in my project. There are some strings that I use common between them. Is there a way that I can define an environment variable then use it in all three files

For instance, in c_cpp_properties.json I have:

"compilerPath": "/some/path/to/sysroots/x86_64-petalinux-linux/usr/bin/aarch64-xilinx-linux/aarch64-xilinx-linux-g++"

In tasks.json I have:

"command": "/some/path/to/sysroots/x86_64-petalinux-linux/usr/bin/aarch64-xilinx-linux/aarch64-xilinx-linux-g++ --sysroot=/some/path/to/sysroots/aarch64-xilinx-linux -g test.cpp -o build/test"

In launch.json I have:

"miDebuggerPath": "/some/path/to/sysroots/x86_64-petalinux-linux/usr/bin/aarch64-xilinx-linux/aarch64-xilinx-linux-gdb"

I want to just define "${sysroots} = /some/path/to/sysroots" once, then just use that variable in all three files. That way if I have to change it, I only need to change it in one place. This seems like pretty obvious functionality. Am I missing something?

jvtnv
  • 86
  • 5

0 Answers0