[PATCH] Document new LLVM CMake interface and emit warning when using llvm_map_components_to_libraries

Dan Liew dan at su-root.co.uk
Mon Jul 28 06:25:21 PDT 2014


On 28 July 2014 14:01, Brad King <brad.king at kitware.com> wrote:
> On 07/28/2014 08:15 AM, Dan Liew wrote:
>> http://llvm.org/docs/Projects.html
>>
>> I think the "Embedding LLVM in your project" documentation on using
>> LLVM libraries via CMake belongs in here instead. Do you agree?
>
> No.  IIUC that document is for creating projects that may build as
> part of LLVM.  The document you've been modifying is about using LLVM
> libraries externally in an application that builds separately.

"
How-to guide and templates for new projects that use the LLVM
infrastructure. The templates (directory organization, Makefiles, and
test tree) allow the project code to be located outside (or inside)
the llvm/ tree, while using LLVM header files and libraries.
"

Although it is true that this documentation is for projects that
"piggy-back" off the LLVM Autoconf/Makefile build process, it is also
for projects that build outside of the LLVM tree (e.g. KLEE) against
LLVM libraries (but still piggy-backing off LLVM's Makefiles) which
the new infrastructure can do (and more because it can build against
an installed LLVM as well).

I worry that someone starting a new project will only come across this
document and will start using the Autoconf/Makefile build system
without realising that the better (IMHO) CMake option is available.

An alternative I guess would be to fix up LLD and Clang so that they
use the new LLVM Exported targets when built outside the LLVM build
tree (currently they invoke the llvm-config executable to get the
information they need) and once that works properly document this
process in Projects.rst. If you think that's sensible then a
discussion about this should probably go to llvm-dev.

Thanks,
Dan.



More information about the llvm-commits mailing list