I'm trying to build one of examples from standard distribution, namely BrainF and haven't succeed.
I made my copy of examples/BrainF and trying to run cmake from this dir. Initially CMakeLists.txt looked like this:
set(LLVM_LINK_COMPONENTS jit bitwriter nativecodegen interpreter)
add_llvm_example(BrainF
BrainF.cpp
BrainFDriver.cpp
)
cmake complained about add_*. I read through http://llvm.org/docs/CMake.html#embedding and decided to add some prelude to CMakeLists.txt:
find_package(LLVM)
# Define add_llvm_* macro's.
include(AddLLVM)
add_definitions(${LLVM_DEFINITIONS})
include_directories(${LLVM_INCLUDE_DIRS})
link_directories(${LLVM_LIBRARY_DIRS})
Then cmake complained about the fact that it could't perform find_package(LLVM)
and suggested to look for LLVMConfig.cmake or llvm-config.cmake. The closest thing that I found laid under /usr/src/llvm/cmake/modules/LLVM-Config.cmake so I set CMAKE_PREFIX_PATH=/usr/src/llvm/cmake/modules/
and made soft link LLVMConfig.cmake to LLVM-Config.cmake.
Then cmake complained this way: “include could not find load file: AddLLVM”. If I hardcode the whole path to include AddLLVM.cmake the problem goes to includes which exist inside the AddLLVM.cmake so it doesn't seem like the right way to get things done.
My environment is Xubuntu 12.04 and llvm+clang 3.1 (got deb package from some ppa, backport from Debian).