OSDN Git Service

[cmake] Make LIT_COMMAND configurable and improve fallback support
authorMichal Gorny <mgorny@gentoo.org>
Sat, 1 Oct 2016 09:28:05 +0000 (09:28 +0000)
committerMichal Gorny <mgorny@gentoo.org>
Sat, 1 Oct 2016 09:28:05 +0000 (09:28 +0000)
commit310d306126ea8ab52714f285d27d6dd7995c961d
tree1b19ddefb33a51d862b4d2f501deb65399572d32
parentbf7d569cfb17fcf71499f4ab7be0b311e12ce731
[cmake] Make LIT_COMMAND configurable and improve fallback support

Make LIT_COMMAND configurable, use source tree only when actually
available and extend the default search to other common executable names
'lit.py' and 'lit', in order to increase uniformity between all LLVM
projects and support using installed lit.

Changing the conditional used to determine whether in-tree or external
lit is being used covers the case when LLVM_MAIN_SRC_DIR is defined but
does not exist (anymore). In this case, the functions falls back to
looking for installed lit rather than attempting to use a non-existing
path. The same conditional is used in clang already.

Making LIT_COMMAND a cache variable in case the source tree variant is
used serves two purposes. Firstly, it increases uniformity between
the two branches since find_program() implicitly makes LIT_COMMAND
a cache variable. Secondly, it allows overriding the lit executable used
to run the tests when the LLVM source tree is provided. Gentoo is
planning to use this to use installed (and byte-compiled) lit instead of
re-compiling it in every LLVM project.

Extending default search is meant to increase uniformity between
different LLVM projects. The 'lit.py' name is already used by a few of
them, and 'lit' is the name used by utils/lit/setup.py when installing.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283029 91177308-0d34-0410-b5e6-96231b3b80d8
cmake/modules/AddLLVM.cmake