[runtimes] Properly handle the sysroot/triple/gcc-toolchain
authorLouis Dionne <ldionne.2@gmail.com>
Tue, 12 Oct 2021 19:59:08 +0000 (15:59 -0400)
committerLouis Dionne <ldionne.2@gmail.com>
Thu, 21 Oct 2021 14:06:11 +0000 (10:06 -0400)
commit72117f2ffeb6a096a808c34ec7ebee122c2d2e21
tree6e48668059ca37f13d97944e34a9ff0dffc898a7
parentaa3519f178fc6ea563f950a4077b34d8dc6c4470
[runtimes] Properly handle the sysroot/triple/gcc-toolchain

In 395271a, I simplified how we handled the target triple for the
runtimes. However, in doing so, we stopped considering the default
in CMAKE_CXX_COMPILER_TARGET, so we'd use the LLVM_DEFAULT_TARGET_TRIPLE
(which is the host triple) even if CMAKE_CXX_COMPILER_TARGET was specified.
This commit fixes that problem and also refactors the code so that it's
easy to see what the default value is.

The fact that nobody seems to have been broken by this makes me think
that perhaps nobody is using CMAKE_CXX_COMPILER_TARGET to specify the
triple -- but it should still work.

Differential Revision: https://reviews.llvm.org/D111672
libcxx/CMakeLists.txt
libcxxabi/CMakeLists.txt
libunwind/CMakeLists.txt