[CMake] How to import Clang targets?

Hi all,

Say I have downloaded LLVM/Clang 3.7.0, unpacked Clang to the tools/clang directory and built the whole project. Since LLVM installs a bunch of useful *.cmake files, including LLVMExports/LLVMConfig it is pretty easy to link against LLVM targets. However, I don’t see any option to link against Clang libraries in this configuration, since Clang doesn’t export anything in case if it was built as a part of LLVM.

Is this intended and what should I do to import Clang targets properly? Am I missing something?

Hi Adolphe:

Support for installing clang config files when building llvm+clang was recently added, but isn’t available in 3.7. Please see:

https://mail.google.com/mail/u/0/?tab=wm#label/llvm-reviews/1503a5137d9128d3

It’s a trivial fix, so if you make that change and your version of cmake is >= 3.0, you can rebuild and install will generate the clang config files for you.

hth…
don

Hi Don,

That works, thank you!

Glad it helped…