-
Notifications
You must be signed in to change notification settings - Fork 454
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-presets attribute toolset gets ignored when generator attribute is empty #4156
Comments
Hi @m1lhaus , thanks for reporting issue here! cmake configure is executed from console (cmd.exe) cmake configure is executed from VSCode via cmake tools extension As you said above, after added |
Hello @Amy-Li03, well I get different result: In both cases I am executing my only preset. See code snippet bellow. Also I am bit skeptical about how you are running it from the console. I can't see you explicitly calling a preset. This would be a dummy preset I can share
|
Hi @m1lhaus , thanks for your quick response! @gcampbell-msft I can repro customer's issue: when generator attribute is empty, C/C++ compilers are taken from V141 toolset when cmake configure is executed from console( I'm not sure if this is a feature request or a bug? |
@m1lhaus Yes, this does seem to be a bug based on the command-line behavior and the CMake Presets spec. The only time this wouldn't be a bug would be if you're using a presets version prior to v3, but even then, we would require the generator field, so therefore this is definitely a bug and we will mark/treat it as such. Thanks! |
Brief Issue Summary
In our project we are using Visual Studio generators in order to generate cmake project with VS2017 compilers (V141 toolset). In other words, across the team we have different versions of Visual Studio ranging from 2017 to 2022 with only one common denominator and that is target Visual C++ toolset. In our case it is V141 which are VS2017 compilers. So users normally generate their solutions by omitting -G flag and just providing -T v141 and -A x64 flags. Cmake will handle the rest and find compatible Visual Studio.
Now I have a configure-presets that inherit this:
This works great when cmake configure is executed from console (cmd.exe). CMake correctly identifies that my generator is VS2022 since its the only Visual Studio I have installed on my PC. I can see from cmake logs that proper version of C/C++ compilers is selected (V141 toolset).
Now when I configure the same preset from VSCode via cmake tools extension, no matter what always the latest C/C++ compilers are taken from VS2022 (V143 toolset). Even if I put some random string garbage for toolset value, cmake cmake tools would still configure with VS2022 compilers.
Only if I provide specific generator to CMakePresets.json file, in my case "Visual Studio 17 2022", toolset attribute starts working and cmake project with correct compilers gets generated. This looks like a bug to me since cmake itself can handle that by no issue. Or am I missing something?
CMake Tools Diagnostics
Debug Log
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: