build: add support for standalone lld build

Enable building lld as a standalone project. This is motivated by the desire to
package lld for inclusion in a linux distribution. This allows building lld
against an existing paired llvm installation. Now that lld is usable on x86_64,
it makes sense to revive this configuration to allow distributions to package
it.

llvm-svn: 289421
diff --git a/lld/COFF/CMakeLists.txt b/lld/COFF/CMakeLists.txt
index 39d95bb..a0ff9c5 100644
--- a/lld/COFF/CMakeLists.txt
+++ b/lld/COFF/CMakeLists.txt
@@ -2,6 +2,10 @@
 tablegen(LLVM Options.inc -gen-opt-parser-defs)
 add_public_tablegen_target(COFFOptionsTableGen)
 
+if(NOT LLD_BUILT_STANDALONE)
+  set(tablegen_deps intrinsics_gen)
+endif()
+
 add_lld_library(lldCOFF
   Chunks.cpp
   DLL.cpp
@@ -41,5 +45,5 @@
 
   DEPENDS
   COFFOptionsTableGen
-  intrinsics_gen
+  ${tablegen_deps}
   )