How to change clang toolset root directory

Hi everyone,

We are using cmake 3.22 with vs2022 generator and clang toolset: -G “Visual Studio…” -T ClangCL
In VS there is a way to install clang tools: two check boxes, such that when cmake is invoked it finds automatically the clang binary at: C:\Program…\Microsoft…\2022\VC\Tools\LLVM\bin\clang-cl.exe

But we need a different clang version than the one in VS, how can we achieve that?
I tried to uninstall the two check boxes of clang installation in VS but then cmake does not find the other
clang in its default install directory.
I tried to set CMAKE_CXX_COMPILER variable from cmake invocation command (via -D) and it does
not work neither.

Any suggestion?
Thanks,
Serge

The -T flag can support other parameters. I don’t know which ClangCL supports, but it might be something like version=… or the like. So it’d look like something like -T ClangCL,version=14.

Thanks Ben for your answer, I’ll check that