Can't cross-compile for Windows since CMake > 3.17.2

I’m using vcpkg to cross-compile libraries for Windows, I use the llvm 9 + clang-cl 9 toolchains and since the new update of vcpkg that brought cmake to 3.18.4 I can’t cross-compile anymore, it seems the linker searched is ar instead of lld-link:

cmake 3.18.4

CMAKE_AR-NOTFOUND /machine:X86 /nologo /out:lib/libglew32.lib CMakeFiles/glew_s.dir/vcpkg /buildtrees/glew/src/glew-0d6dec840c.clean/src/glew.c.obj && :
FAILED: lib/libglew32.lib

cmake 3.17.2

/usr/bin/lld-link-9 /lib /machine:X86 /nologo /out:zlib.lib CMakeFiles/zlib.dir/adler32.obj CMakeFiles/zlib.dir/compress.obj CMakeFiles/zlib.dir/crc32.obj CMakeFiles/zlib.dir/deflate.obj CMakeFiles/zlib.dir/gzclose.obj CMakeFiles/zlib.dir/gzlib.obj CMakeFiles/zlib.dir/gzread.obj CMakeFiles/zlib.dir/gzwrite.obj CMakeFiles/zlib.dir/inflate.obj CMakeFiles/zlib.dir/infback.obj CMakeFiles/zlib.dir/inftrees.obj CMakeFiles/zlib.dir/inffast.obj CMakeFiles/zlib.dir/trees.obj CMakeFiles/zlib.dir/uncompr.obj CMakeFiles/zlib.dir/zutil.obj

Is there any new option to look for clang-cl’s linker instead of ar when cross-compiling ?

My cmake toolchain file:


This looks a lot like the problem fixed by CMake MR 5264, but that fix was included in 3.18.4. Please open an issue in the CMake Issue Tracker for this.

I see CMake Issue 21532, thanks.