title: LLVM based project lib dependencies for CMake on windows
body: <p>This has been asked here before but I couldn't find a solution which works for me. 
  <a href="https://stackoverflow.com/questions/8286768/sample-cmakelists-txt-file-for-llvm-project">Sample CMakeLists.txt file for LLVM project</a> - This was the original question. </p>
  
  <p>However, there are a couple of issues I am facing when making a project with LLVM.</p>
  
  <p>Platform: Windows 7
  Compiler: MingW</p>
  
  <p>1) Firstly, I am using the svn version of llvm which is currently at 3.1. Currently, Binaries for MingW are not present for llvm 3.0 too so I decided to go with the latest itself and build it with mingw. So although the build works fine, I cannot seem to find the llvm-config perl script in the bin folder. I tried searching the entire dir yet I can only find an llvm-config folder and a dependencies file.</p>
  
  <p>2) I tried building llvm for Visual studio 2010 yet that didn't work with cmake so I had to use MingW.</p>
  
  <p>3) Now, this is sequence in which I add libs to CMake - 
  LLVMXCoreInfo</p>
  
  <p>LLVMMipsAsmPrinter
  LLVMMipsCodeGen
  LLVMMipsInfo
  LLVMMBlazeAsmPrinter
  LLVMMBlazeCodeGen
  LLVMMBlazeInfo
  LLVMLinker
  LLVMipo
  LLVMInterpreter
  LLVMInstrumentation
  LLVMJIT
  LLVMExecutionEngine</p>
  
  <p>LLVMMC
  LLVMBitWriter
  LLVMX86Disassembler
  LLVMX86AsmParser
  LLVMX86AsmPrinter
  LLVMX86CodeGen
  LLVMX86Info
  LLVMAsmParser
  LLVMARMAsmParser
  LLVMMCParser
  LLVMARMAsmPrinter
  LLVMARMCodeGen
  LLVMARMInfo
  LLVMArchive
  LLVMBitReader</p>
  
  <p>LLVMSelectionDAG</p>
  
  <p>LLVMAsmPrinter
  LLVMCodeGen
  LLVMScalarOpts
  LLVMInstCombine
  LLVMTransformUtils
  LLVMipa
  LLVMAnalysis
  LLVMTarget
  LLVMMC
  LLVMCore</p>
  
  <p>LLVMSupport</p>
  
  <p>imagehlp
  psapi
  m</p>
  
  <p>4) However, adding InitializeNativeTarget(), starts giving me linking errors which I think come because of the dependencies not being in right order.</p>
  
  <p>5) I want to use the llvm_map_components_to_libraries(REQ_LLVM_LIBRARIES jit native) and hence I added this to my CMakeLists.txt 
  INCLUDE(cmake/LLVM-Config.cmake)</p>
  
  <p>However, this doesn't work. CMake Error at cmake/LLVM-Config.cmake:141 (message):
    Library `jit' not found in list of llvm libraries.</p>
  
  <p>Now, the question is really too long but I basically wanted to ask what is the best way to do this in CMake. Could someone post the entire thing (for windows).
  Also, is there a way to build it for VS 2010. I tried the instructions on CLang site but those gave me this error in CMake.</p>
  
  <p>" string sub-command REGEX, mode MATCH needs at least 5 arguments total to command."</p>
  
  <p>I really need some help figuring out how to get dependencies to work in llvm and for it to build with VS. I would really appreciate some help. </p>