Error when using CMake with LLVM
<p>So I'm trying to build a toy compiler using LLVM and I'd like to use CMake as my build system. I tried using the <a href="http://llvm.org/docs/CMake.html#embedding-llvm-in-your-project" rel="noreferrer">sample CMakeLists.txt</a> from LLVM's website, but I encounter the following error when running <code>cmake</code>:</p>

<pre><code>CMake Error at /usr/share/llvm-3.8/cmake/LLVMConfig.cmake:178  (include):
  include could not find load file:

    /usr/share/llvm/cmake/LLVMExports.cmake
Call Stack (most recent call first):
  CMakeLists.txt:4 (find_package)


CMake Error at /usr/share/llvm-3.8/cmake/LLVMConfig.cmake:181 (include):
  include could not find load file:

    /usr/share/llvm/cmake/LLVM-Config.cmake
Call Stack (most recent call first):
  CMakeLists.txt:4 (find_package)
</code></pre>

<p>When I went to go investigate the problem, I discovered that the path on my system is actually <code>/usr/share/llvm-3.8/</code>. When I tried changing the path to <code>/usr/share/llvm/</code> like it expects, I get another error:</p>

<pre><code>CMake Error at /usr/share/llvm/cmake/LLVMExports.cmake:1034 (message):
  The imported target "LLVMSupport" references the file

     "/usr/lib/libLLVMSupport.a"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/usr/share/llvm/cmake/LLVMExports.cmake"

  but not all the files it references.
</code></pre>

<p>I'm not really an expert on how exactly CMake works, so I'm not sure where to go from here. I'm running Ubuntu 16.04, and I've tried installing LLVM through various different packages with the same results. Is this a problem with Ubuntu's packaging system, or is something that I can fix?</p>