[llvm-dev] Building SVN head with CMake - shared libraries?

Brad King via llvm-dev llvm-dev at lists.llvm.org
Tue Jan 19 06:01:28 PST 2016


On 01/17/2016 02:53 PM, Dan Liew wrote:
> @Brad: CC'ing you because I know you use
> ``llvm_map_components_to_libnames()`` so you will likely have
> something to say about it breaking.

I'm using it in CastXML but that could easily be adapted to something
different if needed.  The larger concern is that that API is the
documented way to use LLVM in an application with CMake so there could
be many such clients.

> * The way that LLVM components are linked against seems really messy
> to me. We have this ``llvm_config()`` macro for linking against
> components but also ``llvm_add_library()`` does this too. We don't
> need two ways of doing the same thing. I think there should be one
> clean way of doing this.
> 
> * If the static libraries are not installed then external projects
> that use LLVM via [1] won't build because
> ``llvm_map_components_to_libnames()`` only works with the static
> libraries. We need to provide something better that does the right
> thing automatically but allows forcing to use the static components or
> the dynamic library.

IIUC the purpose of asking applications to map component names
instead of directly naming libraries is so that the set of actual
libraries can be changed out underneath while retaining the same
components.  This abstraction means that if only the shared library
is installed then ``llvm_map_components_to_libnames()`` can simply
return it for all components built into it.  Its implementation just
needs to be made conditional on the option for static libraries.

-Brad



More information about the llvm-dev mailing list