I want to build an x86 Windows application on my x64 Windows machine.
I use CMake, Ninja, clang-cl, lld-link and the VS Build Tools 2017 with the following CMakeList
CMake Issue #16259: "Ninja generator fails with clang-cl when mixing 64/32 bit clang and Visual Studio Environment" suggests utilizing environment variables:
The Ninja generator requires that the environment already be configured for the compiler to produce the desired target. You need to do
>set CC=clang-cl >set CFLAGS=-m32 >set CXX=clang-cl >set CXXFLAGS=-m32
to tell CMake how to invoke the compiler for the desired target.