microsoft / vscode-cmake-tools

CMake integration in Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=vector-of-bool.cmake-tools
MIT License
1.48k stars 458 forks source link

Custom visualStudio kit PATH setting is ineffective #3849

Closed quanzhuo closed 4 months ago

quanzhuo commented 5 months ago

Brief Issue Summary

Problem Description

Adding a custom visualStudio Kit to the cmake-tools-kits.json file and setting environmentVariables.PATH, but when using this Kit in vscode, the PATH setting is ineffective. Example kit as follows:

  {
    "name": "Qt 5.15.2 msvc2019_64 (Qt Support)",
    "visualStudio": "4e5650fa",
    "visualStudioArchitecture": "x64",
    "isTrusted": true,
    "preferredGenerator": {
      "name": "Ninja Multi-Config"
    },
    "cmakeSettings": {
      "QT_DIR": "D:\\apps\\Qt\\5.15.2\\msvc2019_64\\lib\\cmake\\Qt5",
      "Qt5_DIR": "D:\\apps\\Qt\\5.15.2\\msvc2019_64\\lib\\cmake\\Qt5"
    },
    "environmentVariables": {
      "PATH": "d:\\apps\\Qt\\5.15.2\\msvc2019_64\\bin;${env:PATH}"
    }
  }

Setting cmake.loggingLevel to trace, and selecting the custom Kit, you can see the following output in the CMake output panel:

[kit] The environment for kit 'Qt 5.15.2 msvc2019_64 (Qt Support)': {
  "ALLUSERSPROFILE": "C:\\ProgramData",
  "APPDATA": "C:\\Users\\Administrator\\AppData\\Roaming",
  "CMT_DEVRUN": "1",
  "COMPUTERNAME": "DESKTOP-6QMHVF5",
  ...
  "Path": "C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.22621.0\\x64;C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.40.33807\\bin\\HostX64\\x64;C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\VC\\VCPackages;C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\TestWindow;C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer;C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\bin\\Roslyn;C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v10.0A\\bin\\NETFX 4.8 Tools\\x64\\;C:\\Program Files (x86)\\HTML Help Workshop;C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\FSharp\\Tools;C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Team Tools\\DiagnosticsHub\\Collector;C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.22621.0\\\\x64;C:\\Program Files (x86)\\Windows Kits\\10\\bin\\\\x64;C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\\\MSBuild\\Current\\Bin\\amd64;C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319;C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\;C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\Tools\\;C:\\Program Files\\Amazon Corretto\\jdk21.0.3_9\\bin;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Program Files\\Microsoft VS Code Insiders\\bin;C:\\Users\\Administrator\\AppData\\Roaming\\nvm;C:\\Program Files\\nodejs;C:\\Program Files\\Neovim\\bin;C:\\Program Files\\Graphviz\\bin;E:\\downlods\\dev\\flutter\\bin;C:\\Program Files (x86)\\Windows Kits\\10\\Windows Performance Toolkit\\;C:\\Program Files\\Vim\\vim91;C:\\Program Files\\dotnet\\;C:\\Program Files\\Microsoft SQL Server\\150\\Tools\\Binn\\;C:\\Program Files\\Calibre2\\;C:\\Program Files\\doxygen\\bin;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Go\\bin;C:\\Program Files\\GitHub CLI\\;C:\\Program Files\\CMake\\bin;C:\\Program Files\\PowerShell\\7\\;C:\\Program Files\\CMake\\bin;C:\\Users\\Administrator\\.cargo\\bin;C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Launcher\\;C:\\Users\\Administrator\\.pyenv\\pyenv-win\\bin;C:\\Users\\Administrator\\.pyenv\\pyenv-win\\shims;C:\\Users\\Administrator\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\Administrator\\.dotnet\\tools;C:\\Users\\Administrator\\AppData\\Roaming\\nvm;C:\\Users\\Administrator\\go\\bin;C:\\Users\\Administrator\\bin;C:\\Users\\Administrator\\opt\\apache-maven-3.9.5\\bin;C:\\Users\\Administrator\\opt\\gradle-8.4\\bin;C:\\Users\\Administrator\\AppData\\Local\\JetBrains\\Toolbox\\scripts;D:\\repos\\vcpkg;C:\\Program Files\\clang-uml\\bin\\;E:\\downlods\\dev\\depot_tools;E:\\downlods\\dev\\premake-5.0.0-beta2-windows;C:\\Users\\Administrator\\AppData\\Roaming\\nvm;C:\\Program Files\\nodejs;C:\\Users\\Administrator\\go\\bin;C:\\Users\\Administrator\\.dotnet\\tools;C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake\\CMake\\bin;C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake\\Ninja;C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\VC\\Linux\\bin\\ConnectionManagerExe;C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\vcpkg",

The PATH environment variable does not include the path set in the custom Kit. Additionally, this issue does not exist with non-visualStudio Kits.

CMake Tools Diagnostics

No response

Debug Log

No response

Additional Information

No response

quanzhuo commented 5 months ago

Hi Boss, any update on this issue? @gcampbell-msft @moyo1997

gcampbell-msft commented 5 months ago

@quanzhuo Not currently, we are planning this work for 1.19, but we will update when we get to this and are able to work on it. 👍