CMake build using LLVM install dir

Looking at lld's top-level CMakeLists.txt, it looks like its giving
users the option to build the project either from within the LLVM
source tree or against the LLVM install directory via the
LLD_PATH_TO_LLVM_BUILD variable. However, I can't seem to get the
latter approach to work. A couple problems I ran into:

1) The AddLLVM.cmake in the LLVM install directory references
variables that are set in LLVM's top-level CMakeLists.txt.
2) TableGen.cmake expects LLVM_MAIN_SRC_DIR to be set.

Should this work? Is there a doc for how to create new a CMake
project that uses LLVM?


Greg, I removed LLVM_MAIN_SRC_DIR in LLVM. LLD's standalone stuff
might be broken.

In trunk, clang can be built with standalone with installed llvm-config.
For now, standalone stuff in clang could be copied to lld easily, I guess.

We could clean up standalone stuff more clean with CMake's find_package.