[LLVMdev] Embed LLVM/Clang in our project

Óscar Fuentes ofv at wanadoo.es
Sat Jan 19 02:39:05 PST 2013

Ashok Nalkund <ashoknn at qti.qualcomm.com> writes:

>   We want to compile LLVM/Clang and use the resulting
> headers/libraries in our project. But we compile it during out build
> process. I can build LLVM/Clang by adding it to our cmakelists.txt but
> when our code tries to use one of the headers
> (clang/CodeGen/ModuleBuilder.h), its not found as it doesnt exist. If
> I do a 'make install' in the llvm directory, then the file is
> generated in the LLVM_INSTALL_PREFIX directory. Is the 'make install'
> step necessary even though I'm compiling llvm along with my code?

If you wish to use LLVM/Clang whitout installing it, you must add both
the build output header path and the source header path (in this order)
to your list of include paths, like this:

include_directories( ${LLVM_BUILD_DIR}/include ${LLVM_SOURCE_DIR}/include )

Replace LLVM_SOURCE_DIR/LLVM_BUILD_DIR with the respective directories.
Same for Clang

More information about the llvm-dev mailing list