With this patch, the user can set CMAKE_PREFIX_PATH=<llvm_install_dir>. CMake's find_program() will find llvm-lit.
This file "cmake/modules/AddLLVM.cmake" ends up in the LLVM install directory. But from that location, the user cannot use the lit macros unless they set LLVM_MAIN_SRC_DIR. Reaching into the source directory is not necessary because the freshly built 'llvm-lit' is also in the LLVM install directory. This patch allows the build to find llvm-lit.
I asked some questions about this change in my previous mail.
Sorry, my last reply intended to answer your question, but I see how it wasn't too clear. Take 2:
Is the idea here to support lit testing of an external project or to enable some unusual build configuration of the standard LLVM modules?
The idea here is to support lit testing of both standard LLVM projects as well as external ones. llvm-lit is in the install directory but it is currently inaccessible via the CMake files in the install directory.