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

Shoaib Meenai via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 13 13:11:14 PST 2017


Author: smeenai
Date: Wed Dec 13 13:11:14 2017
New Revision: 320615

URL: http://llvm.org/viewvc/llvm-project?rev=320615&view=rev
Log:
[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

Modified:
    llvm/trunk/cmake/modules/GetHostTriple.cmake

Modified: llvm/trunk/cmake/modules/GetHostTriple.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/GetHostTriple.cmake?rev=320615&r1=320614&r2=320615&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/GetHostTriple.cmake (original)
+++ llvm/trunk/cmake/modules/GetHostTriple.cmake Wed Dec 13 13:11:14 2017
@@ -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" )




More information about the llvm-commits mailing list