-
Notifications
You must be signed in to change notification settings - Fork 990
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
conan.tools.microsoft.VCVars generator does not follow settings.compiler.update #15522
Comments
Hi @puetzk Thanks for reporting. The above steps:
Uses by default the However, I am trying to make it work with the
Not sure what would be missing or necessary, maybe CMake cannot properly use previous updates? I have also tried hardcoding the full |
This is probably caused by bug in Visual Studio that should be fixed in 17.10 |
I've tried to reproduce problem with VCVars on 14.34 which can also work properly with CMakeToolchain.
Expected version for compiler (in case of --vcvars_ver=14.34):
|
This is being fixed by #15588 But I'll probably try to extract the relevant pieces to its own independent PR |
I have extracted #15947 Still very concerning that this doesn't work for CMake. Mostly when setting I have also updated to latest, and even if the ticket https://developercommunity.visualstudio.com/t/MicrosoftVCToolsVersion1436176prop/10385615 says Could you please confirm @puetzk @Nekto89 that you also see the same error for |
I haven't tried to use preview version yet. |
Thanks for the clarification, I was confused because they closed the ticket as solved in 17.9, but I got it, and still failing. I was trying the suggestions of those tickets manually fixing the .props internal VS files, and that made it work, so this definitely sounds like a VS bug |
Fixed in #15947 for next 2.3 release |
GenericSystemBlock.get_toolset already has code to combine settings.compiler.version and settings.compiler.update such that compiler.version=193 and compiler.update=7 into a CMakePresets result like
(this doesn't quite work because VSCode also wants to see CMAKE_C_COMPILER=cl, but that's already reported in #13136).
However, conan.tools.microsoft.visual._vcvars_vers does not seem to have similar code to consider settings.compiler.update, so generators="VCVars" will only generate calls like
-vcvars_ver=14.3
, never-vcvars_ver=14.37
vs-vcvars_ver=14.38
. Which means conanbuild.bat won't necessarily get the same minor version that CMakePresets does... or even one that CMake will accepti.e.
conan new cmake_exe -d name=hello -d version=1.0 conan create . -s compiler.update=7
will fail with
conan2 create . -s compiler.update=7 -c tools.cmake.cmaketoolchain:generator=Ninja
is even worse - it just uses compiler.update=8 despite the settings:
In both cases this is because the conanvcvars.bat contains
So the environment finds the latest 14.3x (which is 14.38) and then CMake rejects it as not mathching CMAKE_GENERATOR_TOOLSET
Since conan_toolchain.cmake contains
set(CMAKE_GENERATOR_TOOLSET "version=14.37" CACHE STRING "" FORCE)
, the msbuild generator knows this is wrong; ninja (as usual) doesn't actually check, and just goes by PATH.Similarly, a call like
conan2 create . -s compiler.version=192 -s compiler.update=9 -c tools.microsoft.msbuild:vs_version=17
, which should select C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.29.30133, failed with a CMake error:Originally posted by @puetzk in #13136 (comment)
The text was updated successfully, but these errors were encountered: