microsoft / microsoft/vscode-cmake-tools
CMake Tools does not provide the `/Fo` arg (and others) in a cpptools custom configuration
- Dominant language
- TypeScript
- Stars
- 1.7k
- Forks
- 546
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 32
Description
When I build a file with CMake Tools with a simple example, I'm seeing the following command line used:
```
cl /c /IZ:\repos\Bug\include /Zi /W3 /WX- /diagnostics:column /Od /Ob0 /D _MBCS /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /Fo"MyProject.dir\Debug\\" /Fd"MyProject.dir\Debug\vc143.pdb" /external:W3 /Gd /TP /errorReport:queue Z:\repos\Bug\main.cpp
```
The custom configuration sent to cpptools is missing some of those arguments:
```
"includePath": [
"z:/repos/bug/include"
],
"defines": [],
"compilerPath": "c:/program files/microsoft visual studio/2022/enterprise/vc/tools/msvc/14.35.32215/bin/hostx64/x64/cl.exe",
"compilerArgs": [],
"compilerFragments": [
"/DWIN32 /D_WINDOWS /W3 /GR /EHsc /MDd /Zi /Ob0 /Od /RTC1"
]
```
I've not dug into the importance of the other missing arguments, but cpptools specifically needs the `/Fo` argument. If (and only if) it is a path ending in a backslash or forward slash, it's used as an output directory for `.tlh` files. We need that path to pass to EDGE for `--import_dir`. That argument would be needed in order to properly support [`#using` of COM `.tlb` files](https://github.com/microsoft/vscode-cpptools/issues/10710) in cpptools.
Contributor guide
Research direction
Start by tracing how CMake Tools generates the cpptools custom configuration, then compare the full MSVC command line with compilerArgs and compilerFragments. The issue is done when the required trailing-directory /Fo value is propagated so cpptools can use it as the EDGE import directory.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp, vscode
- Domain
- build-system, devtools, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100