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

Brad King brad.king at kitware.com
Tue Sep 9 08:20:07 PDT 2014


On 09/09/2014 10:12 AM, Dan Liew wrote:
> because my Linux distribution just upgraded to LLVM/Clang 3.5 and I
> noticed that trying use find_package(LLVM ...) was broken :(

AFAIK, that never worked in any version of LLVM not built by CMake before.
That's why we taught cmake/modules/Makefile to generate LLVMConfig.cmake
and LLVMExports.cmake.

> What is happening is that none of the libraries are being added into
> LLVMExports.cmake file when it is generated by ``cmake/modules/Makefile``.
[snip]
> One way to "fix" this is make sure LLVMConfigLibs is also set when
> using --enable-shared as the attached patch does.

The patch works for me and is likely sufficient at least for a fixup
during distro packaging and perhaps also in the 3.5 release branch.

Making the shared library itself available as an imported target is
a separate problem for another day (like when the CMake build system
is taught an equivalent to --enable-shared).

> Perhaps ``cmake/modules/Makefile`` should invoke llvm-config itself?

It looks like LLVMConfigLibs was created in r112714 for local use in
Makefile.rules.  The only use outside Makefile.rules is now in
cmake/modules/Makefile.  Teaching cmake/modules/Makefile to do
a direct invocation would be fine with me.

Thanks,
-Brad



More information about the llvm-dev mailing list