This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by smeenai on Dec 13 2017, 12:38 AM.

Details

Summary

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.

Event Timeline

smeenai created this revision.Dec 13 2017, 12:38 AM
zturner accepted this revision.Dec 13 2017, 8:54 AM
This revision is now accepted and ready to land.Dec 13 2017, 8:54 AM
This revision was automatically updated to reflect the committed changes.