[CMAKE] Provide default location for llvm-lit for out-of-tree users.
authorStephen Neuendorffer <stephen.neuendorffer@xilinx.com>
Mon, 30 Mar 2020 22:32:01 +0000 (15:32 -0700)
committerStephen Neuendorffer <stephen.neuendorffer@xilinx.com>
Wed, 22 Apr 2020 22:13:23 +0000 (15:13 -0700)
commit45526d29a5b2cf126b83ada3991921970007d16f
treecc9e5a8fe8a504db2f7dca237a5e7bb228ff779b
parent2899103108d38215af8aae377cd0e54794278209
[CMAKE] Provide default location for llvm-lit for out-of-tree users.

Several external build users contain some heuristics for finding llvm-lit.
There are several cases we need to worry about:
- External builds against a build tree (with LLVM_BUILD_UTILS)
- External builds against an install tree (with LLMV_BUILD_UTIL
  and LLVM_INSTALL_UTILS)
- External builds against some location which doesn't have an
  llvm-lit, but llvm-lit is available through some other means, such
  as an available source tree, or a packager provided llvm-lit.

For the third case, LLVM_EXTERNAL_LIT suffices, but in other cases
there's no standard way to find llvm-lit.  It seems like each user
cooks their own heuristics:

- clang tries to look in the LLVM source tree, and failing that falls
  back to looking for a packaged llvm-lit.
- libcxx tries to look in the LLVM source tree, which might come from
  llvm-config or be explicitly specified.

This patch is a first stop to solving this by providing a default location
for llvm-lit using LLVM_DEFAULT_EXTERNAL_LIT.  The expectation is that
future patches can clean up users like clang and libcxx to rely
on this mechanism for out-of-tree builds.

Differential Revision: https://reviews.llvm.org/D77110
llvm/cmake/modules/CMakeLists.txt
llvm/cmake/modules/LLVMConfig.cmake.in