[LLVMdev] Can't build against LLVM-3.5 with CMake: CMakeExports.cmake broken?

Dan Liew dan at su-root.co.uk
Tue Sep 9 04:09:30 PDT 2014


Hi,

I can't reproduce your issue on the LLVM 3.5 release branch or trunk
it. Looking at your bug report I think your install is messed up

```

CMake Error at /usr/local/Cellar/llvm/HEAD/share/llvm/cmake/LLVMExports.cmake:6
(set_property):
  set_property could not find TARGET LLVMSupport.  Perhaps it has not yet
  been created.
Call Stack (most recent call first):
  /usr/local/share/llvm/cmake/LLVMConfig.cmake:50 (include)
  CMakeLists.txt:4 (find_package)

```

 /usr/local/share/llvm/cmake/LLVMConfig.cmake seems to calling
/usr/local/Cellar/llvm/HEAD/share/llvm/cmake/LLVMExports.cmake which
doesn't make sense. I would try cleaning up your install and start
again. If you intend to working with different versions of LLVM I
don't think it's a good idea to install it anyway. You can just build
your project against the LLVM build directory and add the LLVM tools
to your PATH when you need to.

I have a simple example project that uses ``find_package(LLVM)``.

Here are the steps I followed to build (I build against the LLVM build
directory and don't bother installing it)

$ mkdir tutorial/

# Build LLVM
$ mkdir llvm/
$ cd llvm/
$ svn co http://llvm.org/svn/llvm-project/llvm/branches/release_35 src
$ mkdir build
$ cd build
$ cmake -G Ninja ../src
$ ninja
# This is just for convenience when setting LLVM_DIR later on.
$ LLVM_BUILD_ROOT="$(pwd)"

# Build simple tutorial project
$ cd ../
$ mkdir srg-llvm-pass-tutorial
$ git clone https://github.com/delcypher/srg-llvm-pass-tutorial.git src
$ mkdir build
$ cd build/
# I'm assuming your shell will example ${LLVM_BUILD_ROOT} before invoking cmake
$ cmake -DLLVM_DIR:PATH=${LLVM_BUILD_ROOT}/share/llvm/cmake/ -G Ninja ../src
$ ninja

Hope that helps

Dan.



More information about the llvm-dev mailing list