vscode-cmake-tools
vscode-cmake-tools copied to clipboard
Environmental Variables in CMake Tools
Brief Issue Summary
I've seen similar issues to this throughout the Issues board, but I can't seem to locate a workaround. I have a secret stored in an environmental variable
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Foo/foo-client-cpp
GITHUB_HOST https://github.foo.com
REF 1.1.9
SHA512 097519485gqopegn936
AUTHORIZATION_TOKEN $ENV{AUTH_TOKEN}
)
I can build this from the command line, but I can't find any way to get my environmental variable to be picked up by the extension short of hardcoding the token in the settings file. Which obviously is not great since someone will eventually commit it. The behavior that would be nice is environmental variable expansion in settings.json,
"cmake.environment": {
"AUTH_TOKEN": "${env:AUTH_TOKEN}"
},
but it looks like this hasn't gotten any traction in awhile. I'll pretty much take any workaround that makes this seamless. This seems like something that should work, so apologies if I'm just missing something easy.
CMake Tools Diagnostics
No response
Debug Log
No response
Additional Information
No response
Hi @diehard2 thank you for your post. We'll investigate this issue as soon as we have the bandwidth and get back to you with a fix/workaround.
@diehard2 Could you tell us some more information about your repro project?
Are you using kits or CMake Presets? I've just ran a small test where I updated my CMakeLists.txt to output a variable from the environment, and I was able to confirm that when configuring with the extension, it picks up this value. Therefore, I'm not able to reproduce your issue and I believe we support what you're asking for.
Also, I tested and confirmed that we do support the macro expansion that you were attempting in cmake.environment. Therefore, can you please make sure the extension is updated to the most recent versions and confirm that this works for you?
@diehard2
Closing this issue since we haven't gotten any feedback, and I believe this issue has been resolved through other changes.
Please create a new issue if you are still running into this issue.