# Clang-cl with Visual Studio 2019 generator

**URL:** https://discourse.cmake.org/t/clang-cl-with-visual-studio-2019-generator/4057
**Category:** Usage
**Created:** [September 8, 2021, 7:07pm UTC](https://discourse.cmake.org/t/clang-cl-with-visual-studio-2019-generator/4057 "2021-09-08T19:07:26Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Julian\_LALU](https://discourse.cmake.org/user_avatar/discourse.cmake.org/julian_lalu/32/1762_2.png) [@Julian\_LALU](https://discourse.cmake.org/u/Julian_LALU)
#### Post date: [September 8, 2021, 7:07pm UTC](https://discourse.cmake.org/t/clang-cl-with-visual-studio-2019-generator/4057/1 "2021-09-08T19:07:26Z")

</div>

Hello,

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,
