-
Notifications
You must be signed in to change notification settings - Fork 464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Customize the environment variables when launch the target in the terminal #3478
Comments
Thanks for the suggestion, marking this as a request and putting it on our backlog. Thanks! |
Seconding this, would be much appreciated! |
Finally found, thanks to this question and answer, that this feature is not enabled! I've been stumbling for a couple of days trying to give my executable a chance to use a specific project environment in Launch mode, without any success. Please take into account that this is an essential feature when the program uses 3rd party DLLs: the PATH (Windows) or LD_LIBRARY_PATH (Linux) must be set accordingly for the program execution. According to the documentation (https://github.com/microsoft/vscode-cmake-tools/blob/main/docs/cmake-settings.md), "cmake.environment" in settings.json should be used for running also, but the fact is that it is only applied when debugging. |
@AlMar-Devel Do you have a repro project? I have tested this for a similar issue #3687 and I wasn't able to reproduce the issue. We add the configure environment, which for presets and for kits should include the |
I can reproduce that cmake.environment & cmake.debugConfig.environment & cmake.testEnvironment all apply to debugging projects and does not apply to launching projects from terminal. In my case, i'm going to set QT_QPA_PLATFORM=xcb. Is it intended? |
Hi @1m188 @AlMar-Devel @mcwindy, |
I completed the PR, so the fix should be available in the next release. Please open a new issue if the problem persists. Thanks! |
Brief Issue Summary
When using the launch target feature of the cmake plugin, the cmake plugin will start a terminal and then run the target directly.
But I'd like to be able to plug in some custom configurations after launching the terminal like environment variables, etc. (because there may be multiple environment variables with the same key in different projects, and I don't want them to pollute the global environment variables).
Admittedly, we can manually add environment variables to the terminal and reuse that terminal afterward, but the problem is that the terminal needs to be manually configured after each launch of vscode, which is tedious. (In my personal case, in order to run the Qt program, I need to temporarily add the corresponding bin directory to the system path in the terminal every time I start the terminal, which is troublesome)
I didn't find the relevant settings to fix this, I hope to be able to add this feature in the subsequent updates of the cmake plugin, thanks.
CMake Tools Diagnostics
No response
Debug Log
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: