[LLVMdev] Can't build against LLVM-3.5 with CMake: CMakeExports.cmake broken?
Dan Liew
dan at su-root.co.uk
Tue Sep 9 07:12:33 PDT 2014
Hi David,
CC'ing Brad King and Eric Christopher as they'll probably be interested.
I've just managed to reproduce your issue David. I figured this out
because my Linux distribution just upgraded to LLVM/Clang 3.5 and I
noticed that trying use find_package(LLVM ...) was broken :( . They
use the Autoconf/Makefile build system (specifically because the CMake
build system doesn't support generating a single versioned shared
library) and use --enable-shared flag to configure.
What is happening is that none of the libraries are being added into
LLVMExports.cmake file when it is generated by
``cmake/modules/Makefile``. So when a CMake project tries to use
``find_package()`` it complains about the missing targets.
This is happening because the ``LLVMConfigLibs`` makefile variable is
empty when used in ``cmake/modules/Makefile``. It is normally set in
Makefile.rules . However if you build with --enable-shared this
variable doesn't get set and so LLVMExports.cmake isn't generated
correctly.
@David: Were you also compiling this way?
One way to "fix" this is make sure LLVMConfigLibs is also set when
using --enable-shared as the attached patch does. I'm not convinced
this is the right way to do it though. Perhaps
``cmake/modules/Makefile`` should invoke llvm-config itself?
This is rather annoying. I didn't catch this before because when I was
testing I never used --enable-shared.
Thoughts?
Thanks,
Dan.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: llvm_fix_broken_cmake_package_under_autoconf_enableshared.patch
Type: text/x-patch
Size: 1130 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140909/d8afa40a/attachment.bin>
More information about the llvm-dev
mailing list