microsoft / microsoft/vscode-cmake-tools

environmentSetupScript does not update cmake executable path for vscode

Open
#3,438 3 comments 2 reactions 1 assignee Claimed by @andreeis View on GitHub
bug Feature: settings
Dominant language
TypeScript
Stars
1.7k
Forks
546
Avg merge
2d 16h
Merged PRs (30d)
32

Description

### Brief Issue Summary

I am using a devcontainer that has cmake version 3.16 installed in the base image.
I am using Conan to fetch my dependencies and also fetch a newer version of cmake (3.26). Conan installs that in its default path and handles everyhting.

When conan has installed all its dependencies it gives me a conanbuild.sh script to source so that all my env variables and paths are set according to how conan has set everything up.
When running
`$ source conanbuild.sh`
In the terminal and i later type
`cmake --version`
It gives med 3.26

I tried to add conanbuild.sh as the environmentSetupScript in the cmake-kits.json file. I have also added cmake.loggingLevel: debug in the settings.json so that it outputs a lot more logs. I get this in my output when selecting my cmake kit.
```
[kit] OK running /home/builder/myProject/build/conanbuild.sh,
"PATH":"/home/builder/.conan2/p/cmake5aa963403baef/p/bin
```
According to the logs it seems that the script was executed successfully and modified the PATH variable to include the path to where conan has installed cmake verison 3.26.

When I try to configure cmake with cmake-tools it still gives me this error:
`CMake 3.20.0 or higher is required. You are running version 3.16.3`

If I source conanbuild.sh manually in the terminal and manually configure cmake in the terminal it succeeds cause cmake version is 3.26.
But vscode still has the old version of 3.16 when trying to configure using cmake-tools, even though the logs from the cmake-kit states that everything was OK. I have tried restarting and reloading vscode several times but nothing works

I am expecting that my cmake configuration is based on the cmake-kit i have selected and all environment configuration that script is doing.

My ugly work around at the moment is that I have manually modified the cmakePath in settings.json
` "cmake.cmakePath": "/home/builder/.conan2/p/cmake5aa963403baef/p/bin/cmake"
`

### CMake Tools Diagnostics

_No response_

### Debug Log

_No response_

### Additional Information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.