This is an archive of the discontinued LLVM Phabricator instance.

[cmake] Fix native tooling when cross-compiling on Linux
ClosedPublic

Authored by smeenai on Aug 20 2021, 9:23 AM.

Details

Summary

At least as of CMake 3.20.3, the CMake platform file for Linux doesn't
define the file type prefix and suffix variables, relying on them being
implicitly empty when they're unset. If we're cross-compiling targeting
Windows on a Linux machine, the values of these prefixes and suffixes
populated by the Windows platform file will still be set after including
the Linux platform file, so we'll incorrectly assume the ".exe" suffix
for the host machine. Explicitly unset the variables before including
the platform file, to prevent any previous values from leaking. Thanks
@beanz for suggesting the fix.

Diff Detail

Event Timeline

smeenai created this revision.Aug 20 2021, 9:23 AM
smeenai requested review of this revision.Aug 20 2021, 9:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 20 2021, 9:23 AM
beanz accepted this revision.Aug 20 2021, 10:01 AM

Yep, that's exactly what I was suggesting. Seems to work as expected for me locally.

This revision is now accepted and ready to land.Aug 20 2021, 10:01 AM
This revision was landed with ongoing or failed builds.Aug 20 2021, 10:05 AM
This revision was automatically updated to reflect the committed changes.

Yep, that's exactly what I was suggesting. Seems to work as expected for me locally.

Yep, works for me too. Thanks for the quick review!