I will split the question into 2 posts because of the complexity. I'll create a second post after I have an answer for the first part.
Background: we are using a python virtual environment with
- conan to manage dependencies (compiler)
- invoke to simplify use, and vscode as development environment.
- We activate the virtual environment in the shell
- we call invoke, which adds the conan packages to the path
- then starts vscode
I want to be able to press F7 in vscode and compile my project using cmake tools, but i can't get the extension to find my compiler since it is a conan package and not in the windows path.
First part of the question: how to pass my shell path to vscode?
Currently we have:
def _run_in_venv(ctx, folder, command, **kwargs):
with ctx.cd(folder):
with ctx.prefix("activate_build.bat"):
with ctx.prefix("activate.bat"):
ctx.run(command, **kwargs)
and
env = {"BUILD_DIR": f"{folder}", "PATH": f"{os.getenv('PATH')}"}
_run_in_venv(ctx, folder, "code" + workspace_arg, env=env, echo=True)
I see that the compiler is in os.getenv('PATH'), but when i check the terminal in vscode (echo $env:path), it is completely different. BUILD_DIR is passed ok.
If i put the os.getenv('PATH') into a different variable TEMP, it is passed correctly (echo $env:temp).
I hope, that if i have the compiler in $env:path, cmake tools will recognize it. If it won't i'll create a second question regarding the cmake tools configuration.