[cmake] Support overriding llvm-config query results
authorMichal Gorny <mgorny@gentoo.org>
Wed, 14 Sep 2016 13:42:31 +0000 (13:42 +0000)
committerMichal Gorny <mgorny@gentoo.org>
Wed, 14 Sep 2016 13:42:31 +0000 (13:42 +0000)
commit697026f312c22e6dded579dce0b7691591897e83
tree401c826fdb073c4560556de492b2eb4b45af48d0
parentcd56273ff1e8d4ffaaac12e38b9aadd3d8781687
[cmake] Support overriding llvm-config query results

Support overriding LLVM_* variables obtained from llvm-config when doing
stand-alone builds. The override of LLVM_MAIN_SRC_DIR is necessary to
provide LLVM sources when the initial directory used to build LLVM does
no longer exist when compiler-rt is built stand-alone. This is
especially the case when building the projects separately in temporary
directories with unpredictable names.

The code is based on existing CMakeLists.txt from clang. Alike clang, it
extends the override to all queried variables.

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

llvm-svn: 281461
compiler-rt/cmake/Modules/CompilerRTUtils.cmake