microsoft / vscode-cmake-tools

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

macros for penv/env not expanded when cache variables for cmake(c/cxx)compilers are included in configure preset #3870

Open qarni opened 5 days ago

qarni commented 5 days ago

Brief Issue Summary

$penv{PATH}/$env{PATH} are not expanded when cache variables for "CMAKE_C_COMPILER": "cl.exe", "CMAKE_CXX_COMPILER": "cl.exe" are included in configure preset. Likely they are overwritten by our vs dev environment magic.

Repro configure preset:

{ "name": "preset", "displayName": "Visual Studio Enterprise 2022 IntPreview - amd64", "description": "Using compilers for Visual Studio 17 2022 (x64 architecture)", "generator": "Visual Studio 17 2022", "toolset": "host=x64", "architecture": "x64", "binaryDir": "${sourceDir}/out/build", "environment": { "PATH": "HELLOTHISISBAD;$penv{PATH}" }, "cacheVariables": { "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}", "CMAKE_C_COMPILER": "cl.exe", "CMAKE_CXX_COMPILER": "cl.exe" } }

CMake Tools Diagnostics

No response

Debug Log

No response

Additional Information

No response

v-frankwang commented 4 days ago

@qarni I used a simple project to reproduce the problem, using message in the CMakeList.txt file to print the value of the PATH, and it would not show the value of the macro. Does this reproduce your problem?

Actual result: image