Environment variable substituion: Kit environment and buildDirectory
See original GitHub issueBrief Issue Summary
"cmake.buildDirectory" : "${env.VARNAME}"
does not work if VARNAME
is set in active kit’s "environmentVariables"
. Empty string is used instead. Ditto for "cmake.installPrefix"
.
Although, the following works fine:
"cmake.buildDirectory" : "${buildKit}"
"cmake.configureSettings: { "SOME_SETTING" : "${env.VARNAME}" }
"cmake.buildDirectory" : "${env.VARNAME}"
- ifVARNAME
is set in environment before running vscode, instead of the kit.
Expected:
Values of variables set in active kit’s "environmentVariables"
to be used in ${env.XXX}
substitution for "cmake.buildDirectory"
and "cmake.installPrefix"
.
Apparent Behavior:
1: .vscode/cmake-kits.json
:
[
{
"name": "TEST_KIT",
"environmentVariables": {"TEST_VAR": "TEST"}
}
]
2: .vscode/settings.json
:
"cmake.configureSettings": {
"TEST_SETTING": "${env.TEST_VAR}"
},
"cmake.buildDirectory": "${workspaceFolder}/__build/${env.TEST_VAR}-${buildKit}-${buildType}",
-
CMake: Select Kit => TEST_KIT
-
CMake: Delete Cache and Reconfigure
-
Output: CMake/Build see below
CMake Tools Log
[proc] Executing command: /usr/local/bin/cmake --no-warn-unused-cli -DTEST_SETTING:STRING=TEST ... -B/home/user/project/__build/-TEST_KIT-Debug ...
Platform and Versions
- Operating System: VSCode UI: Windows 10 1903, VSCode Server: Ubuntu 16 64bit
- CMake Version: 3.17.2
- VSCode Version: 1.45.1
- CMake Tools Extension Version: 1.3.1
- Compiler/Toolchain: GCC 5.4.0
Other Notes/Information
Is it expected bahaviour, am I doing something wrong, or is it a bug?
BTW, thanks for the great extension!
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Use predefined variables - Azure Pipelines - Microsoft Learn
In YAML pipelines, you can reference predefined variables as environment variables. For example, the variable Build.
Read more >Environment Variables - The Cargo Book
Environment variables Cargo sets for build scripts. Cargo sets several environment variables when build scripts are run. Because these variables are not yet...
Read more >Variables - Gentoo Development Guide
There are a number of special variables which must be set in ebuilds, and many more ... In a cross compiling environment, ebuilds...
Read more >Environment - Esy
Some packages need to set environment variables in the environment of the ... where esy "variables" can be used which will automatically be...
Read more >Configuring CMake Tools - vector Of bool
An object containing key : value pairs of environment variables, which will be passed ONLY onto the compiler. Default: null (Unspecified). Supports substitution...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
CMake Tools 1.7.1 was released today and it contains a fix for this issue. Upgrade the extension in VSCode and let us know if you encounter any other problems.
I want to use this “feature” inside cmake.cmakePath in settings.json (in workspace). But it does not work. Neither with version 1.7.1 nor with the current version 1.9.1 od cmake-tools extension. The environment variable is always empty. VScode is version 1.62.2
In cmake.tools-kits.json …
{ “name”: “Ipetronik-Logger (Develop)”, “environmentVariables”: { “IpeBuildPath”: “/home/fabrice/embeddedLinux/Develop/x86_build_develop” }, “toolchainFile”: “/home/fabrice/embeddedLinux/Develop/x86_build_develop/host/usr/share/buildroot/toolchainfile.cmake” },
in settings.json …
“cmake.configureOnOpen”: true, “cmake.cmakePath”: “${env:IpeBuildPath}/host/bin/cmake”, “cmake.generator”:“Ninja”,