microsoft / microsoft/vscode-cmake-tools
Should use the CMake file API to get toolchain details, not assume things are in CMakeCache.txt
- Dominant language
- TypeScript
- Stars
- 1.7k
- Forks
- 546
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 32
Description
### Brief Issue Summary
#2121 describes the problem, but it was closed without actually identifying and fixing the underlying issue. The extension is assuming that `CMAKE_C_COMPILER` and `CMAKE_CXX_COMPILER` are set as cache variables, but this isn't always the case. A toolchain file can (and generally should) set these as regular non-cache variables. When it does so, same-named cache variables won't be created and the extension fails to start debugging due to them being missing.
The appropriate place for the extension to get reliable information about the toolchain is to use the CMake file API. It can use a query for the ["Toolchains" object kind](https://cmake.org/cmake/help/latest/manual/cmake-file-api.7.html#object-kind-toolchains), which includes the path to the selected compiler.
### CMake Tools Diagnostics
_No response_
### Debug Log
_No response_
### Additional Information
_No response_
Contributor guide
Research direction
Start by tracing where the extension reads CMAKE_C_COMPILER and CMAKE_CXX_COMPILER from CMakeCache.txt. Consult the CMake file API Toolchains object kind described in the issue; done means debugging can start when those values are regular toolchain variables rather than cache variables.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, typescript
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100