Support containerEnv:...
variable syntax when setting cmake.cmakePath
in devcontainer.json
#4272
Labels
enhancement
an enhancement to the product that is either not present or an improvement to an existing feature
Feature: settings
Milestone
Discussed in #4060
Originally posted by skycaptain September 12, 2024
I'm setting up a development environment using devcontainers for a project that uses a cross-compiling SDK.
Our setup defines a path to the native sysroot installation using an environment variable called
SDK_NATIVE_SYSROOT
. We aim to use this variable to setcmake.cmakePath
. The documentation states that we can use environment variables in the configuration like this:${env:VARIABLE_NAME}
.Here's what I've tried in my configuration file:
However, this doesn't work. When I run it, I get an error saying it can't find CMake at
/usr/bin/cmake
. It seems like${env:SDK_NATIVE_SYSROOT}
is being replaced with an empty string.Interestingly, if I put the same setting in
.vscode/settings.json
, it works fine.It appears that settings in the devcontainer.json file are evaluated using the
localEnv
before being sent to the devcontainer, while settings in.vscode/settings.json
are evaluated inside the container. However, theSDK_NATIVE_SYSROOT
variable only exists in the container, not on my local computer.This behavior seems counterintuitive, as the settings in
devcontainer.json
are meant for the container, not my local machine. Is there a way to definecmake.cmakePath
exclusively for the container without using.vscode/settings.json
? Using the latter would also override settings for users working locally.According to this issue we should use
${containerEnv:SDK_NATIVE_SYSROOT}
, however this is not supported by this extension.The text was updated successfully, but these errors were encountered: