VS: CMake prevents specifying MSVC version with clangcl toolset
!2093 (merged) added VS toolset version selection. There's a "soft" check that toolset version has a prefix of toolset name, which does not make any sense in case of clangcl
toolset.
Visual Studio allows selecting both, e.g.:
<PlatformToolset>ClangCL</PlatformToolset>
<VCToolsVersion>14.32.31326</VCToolsVersion>
So it would be reasonable to allow specifying -T
as clangcl,version=14.32.31326
. However soft-check prevents that:
https://gitlab.kitware.com/cmake/cmake/-/blob/661e005a/Source/cmGlobalVisualStudio10Generator.cxx#L208
If I remove this check, everything works fine: CMake adds Import
of appropriate props file from VC/Auxiliary/Build, and during the build MSBuild calls clang-cl.exe
with environment variables (INCLUDE, LIB) pointing to appropriate MSVC directory.
The only downside of removing this check is that CMake does not report a meaningful error in case of incorrect MSVC versions like v142,version=14.32
or v143,version=14.29
.