[CMake] Fix runtimes cross-compilation when using LLVM_USE_LINKER
authorVincent Lee <leevince@fb.com>
Wed, 3 Aug 2022 07:00:02 +0000 (00:00 -0700)
committerVincent Lee <leevince@fb.com>
Wed, 3 Aug 2022 18:24:09 +0000 (11:24 -0700)
commitc77db81616805936fa8471241b3b0fce4af12cec
tree619aaab50c28edb13a4af80eff9b17c15937592a
parenta5a8a05c78c0d1298c4128aaafd0275354198afb
[CMake] Fix runtimes cross-compilation when using LLVM_USE_LINKER

This is motivated by https://reviews.llvm.org/D115852#3226050 where passing
`LLVM_USE_LINKER` in PASSTHROUGH_PREFIXES breaks cross-compilation
(e.g. targeting Windows on a Linux host). As suggested on that diff, implement
an override for it by allowing users to pass `RUNTIMES_${target}_LLVM_USE_LINKER`
to specify the linker for runtimes. Defaults to host linker if not specified.

Reviewed By: phosek, smeenai

Differential Revision: https://reviews.llvm.org/D131051
llvm/runtimes/CMakeLists.txt