[cmake] Update lit search to match the one in LLVM
authorMichal Gorny <mgorny@gentoo.org>
Tue, 18 Oct 2016 17:07:30 +0000 (17:07 +0000)
committerMichal Gorny <mgorny@gentoo.org>
Tue, 18 Oct 2016 17:07:30 +0000 (17:07 +0000)
Update the lit search logic to support all names supported in LLVM
(since r283029). The search order (i.e. PATHS vs HINTS) does no really
matter since the established path is not used, except for determining
whether lit is available.

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

llvm-svn: 284496

clang/CMakeLists.txt

index abab6ce..34c2557 100644 (file)
@@ -124,6 +124,7 @@ Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
     endif()
 
     if(EXISTS ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py)
+      # Note: path not really used, except for checking if lit was found
       set(LLVM_LIT ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py)
       if(NOT LLVM_UTILS_PROVIDED)
         add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/FileCheck utils/FileCheck)
@@ -140,8 +141,10 @@ Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
       endif()
     else()
       # Seek installed Lit.
-      find_program(LLVM_LIT "lit.py" ${LLVM_MAIN_SRC_DIR}/utils/lit
-        DOC "Path to lit.py")
+      find_program(LLVM_LIT
+                   NAMES llvm-lit lit.py lit
+                   PATHS "${LLVM_MAIN_SRC_DIR}/utils/lit"
+                   DOC "Path to lit.py")
     endif()
 
     if(LLVM_LIT)