[cmake] Determine MSVC host triple correctly when cross-compiling

CMAKE_CL_64 will never be set when cross-compiling with clang-cl, since
CMake relies on an actual VS environment in order to determine it.
Instead, use the size of a void pointer to determine the bit width of
the host compiler (and therefore the host triple), which works for both
native and cross compilation.

Note that, with the impending advent of Windows on AArch64, assuming
that a 64-bit host == x86_64 isn't correct either, but that's something
to be addressed in a follow-up.

Differential Revision: https://reviews.llvm.org/D41155

llvm-svn: 320615
This commit is contained in:
Shoaib Meenai 2017-12-13 21:11:14 +00:00
parent e25266fd34
commit ef9d2655ca

View File

@ -3,7 +3,7 @@
function( get_host_triple var )
if( MSVC )
if( CMAKE_CL_64 )
if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set( value "x86_64-pc-win32" )
else()
set( value "i686-pc-win32" )