Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake Tools does not provide the /Fo arg (and others) in a cpptools custom configuration #3085

Open
Colengms opened this issue Mar 29, 2023 · 2 comments
Labels
Milestone

Comments

@Colengms
Copy link
Contributor

Colengms commented Mar 29, 2023

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 in cpptools.

@benmcmorran benmcmorran self-assigned this Mar 29, 2023
@benmcmorran benmcmorran added this to the On Deck milestone Mar 29, 2023
@benmcmorran benmcmorran added the bug a bug in the product label Mar 29, 2023
@gcampbell-msft
Copy link
Collaborator

@Colengms Thanks for reporting the issue! I have investigated this and the issue is a gap in what is reported by the CMake File API.

We will investigate improving this and/or finding a fix. Thanks!

@gcampbell-msft
Copy link
Collaborator

Some context:

It appears to repro with the simplest of examples.

cmake_minimum_required(VERSION 3.10)
project(MyProject VERSION 1.0)
add_executable(MyProject main.cpp)
set(CMAKE_VERBOSE_MAKEFILE on)

It repro's with MSBuild, not Ninja, so just don't set the generator and choose a CL kit.

In the verbose build output, you'll see: /Fo"MyProject.dir\Debug\"

In the C/C++ logging output, I see:

Custom configurations received:
...
"compilerFragments": [
"/DWIN32 /D_WINDOWS /W3 /GR /EHsc /MDd /Zi /Ob0 /Od /RTC1"
...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Pending Prioritization
Development

No branches or pull requests

3 participants