Clang-cl with Visual Studio 2019 generator


Currently I have a projet that use CMake to generate Visual Studio 2019 solutions.
Everything works fine, except that when I want to compile the project to target x86 (32bits) platform with clang-cl.
I have an exception when the 32 clang-cl linker (lld-link.exe) is used : Out of Memory. Apparently, I have to use the x64 linker to link the 32 bits object files.
I can’t find a way to do it.

When I’m generating the VS solution I do the following command :
CMake C:\../Sources -G "Visual Studio 16 2019" -A Win32 -T ClangCL
The selected compiler is :
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\Llvm\bin\clang-cl.exe
and the linker is :
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\Llvm\bin\lld-link.exe

The following also don’t works:
CMake C:\../Sources -G "Visual Studio 16 2019" -A Win32 -T ClangCL,host=x64

How can I set the linker to use C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\Llvm\x64\bin\ldd-link.exe instead?

Thank you,

I also try to add the “-m32” flag to the compiler and use the x64 toolset to compile, in this case, I have another error when msbuild run llvm-lib.exe:
file machine type x86 conflicts with library machine type x64 (from '/machine:x64' flag)
Indeed, the llvm-lib add the flag /machine:x64 but I want /machine:x86