-
Notifications
You must be signed in to change notification settings - Fork 55
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
Configure target specific environment variables #90
Comments
That's an interesting idea! Currently, for generate step, this plugin already supports setting env by using kits or variants(though we don't support env option yet). So we should consider the precedence of them. For build and run step, currently there is no convenient way to do this. Maybe we can try to implement your idea. |
Since since you seem to be okay with the general idea of the feature I started with a bit of a Prototype. https://github.com/hfn92/cmake-tools.nvim/commits/env-feature This should already work for launch target but not for building and debugging. And probably only for unix but its a start |
Bravo 👏 |
@hfn92 , this is a good feature, and I would like to test it out fully for windows. Do you have a test project covering all the test cases for this? In the mean time, I found an issue on windows, and now pushed a fix.... This was when executing ~$ cd "C:\Kdev" && cmake --build C:\Kdev\build --target Ktest_compiler_test && cmd /C "cd "C:\Kdev\build\" && C:\Kdev\build\test/Ktest_compiler_test.exe" The ideal command should be: ~$ cd "C:\Kdev" && cmake --build C:\Kdev\build --target Ktest_compiler_test && cmd /C "cd C:\Kdev\build\ && C:\Kdev\build\test/Ktest_compiler_test.exe" I think Windows didn't expect and additional
In terminal.prepare_launch_path:
|
Hi @rohit-kumar-j. I don't really use windows so it's always hard for me to test 😅 . But this should cover most cases int main(int argc, char **argv) {
auto str = std::getenv("str");
auto str_with_ws = std::getenv("str_with_ws");
auto number = std::getenv("number");
assert(str && str == std::string("test_str"));
assert(str_with_ws && str_with_ws == std::string("test str"));
assert(number && number == std::string("1234"));
return 0;
} with the config env = {
number = 1234,
str = "test_str",
str_with_ws = "test str"
}, It always depends on the os and the tool whether not Bit OT but I was wondering if I'm currently on a branch that runs all command trough overseer (hfn92@d256a43). It works fine for me at aleast. |
Currently, overseer.nvim is already a choice of executor, and now the only runner is the terminal, we can also make overseer a runner too. |
Describe the problem or limitation you are having
I sometimes need to run executables with specific environment variables.
This could also be useful for generating and building as some compilers (qnx?) require specific env-vars to compile.
Describe the solution you'd like
Inspired by how QtCreator handles environment variables I think it would be useful to be able to configure env-vars for the generate/configure/build step and for individual targets.
My idea is that the env-vars could be configured in a regular vim buffer using lua code. (Similar to the quick window of harpoon)
For example.
CMakeConfigureBuildEnvironment
would open up a floating window with:This would add
VERBOSE=1
to env-vars for the generate and build stepsAnd
CMakeConfigureRunEnvironment {target_or_current}
for target specific env-vars.This would add
VERBOSE=1 log_file = "/tmp/log.txt" log_level = "trace"
to env-vars when running the specific target.This would also be nice since
cmake-tools
could persist these similar to session.Describe alternatives you've considered
I can just close nvim set env-vars.
The text was updated successfully, but these errors were encountered: