[CMake] Support CMake variables for setting target, sysroot and toolchain
authorPetr Hosek <phosek@chromium.org>
Mon, 4 Feb 2019 20:02:26 +0000 (20:02 +0000)
committerPetr Hosek <phosek@chromium.org>
Mon, 4 Feb 2019 20:02:26 +0000 (20:02 +0000)
commit6fd4e7fe0258ff71fe759535236883ea9060587c
treee6ed894a4ec09bffe442bcdd818fd121e497abfa
parentd19d1972217bd0da7ba2ecad77d257a23be83096
[CMake] Support CMake variables for setting target, sysroot and toolchain

CMake has a standard way of setting target triple, sysroot and external
toolchain through CMAKE_<LANG>_COMPILER_TARGET, CMAKE_SYSROOT and
CMAKE_<LANG>_COMPILER_EXTERNAL_TOOLCHAIN. These are turned into
corresponding --target=, --sysroot= and --gcc-toolchain= variables add
included appended to CMAKE_<LANG>_FLAGS.

libunwind, libc++abi, libc++ provides their own mechanism through
<PROJECT>_TARGET_TRIPLE, <PROJECT>_SYSROOT and <PROJECT>_GCC_TOOLCHAIN
variables. These are also passed to lit via lit.site.cfg, and lit config
uses these to set the corresponding compiler flags when building tessts.

This means that there are two different ways of setting target, sysroot
and toolchain, but only one is properly supported in lit. This change
extends CMake build for libunwind, libc++abi and libc++ to also support
the CMake variables in addition to project specific ones in lit.

Differential Revision: https://reviews.llvm.org/D57670

llvm-svn: 353084
libcxx/CMakeLists.txt
libcxx/test/lit.site.cfg.in
libcxxabi/CMakeLists.txt
libcxxabi/test/lit.site.cfg.in
libunwind/CMakeLists.txt
libunwind/test/lit.site.cfg.in