Improving support for CMake-based applications

Daniel Liew daniel.liew at imperial.ac.uk
Sun Jan 26 16:53:26 PST 2014


This looks interesting, I much prefer CMake to autotools. Do you plan
on modifying the example in ``projects/sample`` or providing a new
example project to demonstrate using the functionality these patches
add?

Thanks,
Dan Liew.

On 24 January 2014 20:44, Brad King <brad.king at kitware.com> wrote:
> Hi Folks,
>
> CMake's preferred way for applications to locate their dependencies is
>
>  find_package(LLVM)
>
> This is supported by LLVM as documented here:
>
>  http://llvm.org/docs/CMake.html#embedding-llvm-in-your-project
>
> by providing the "LLVMConfig.cmake" package configuration file
> (which is distinct from the LLVM-Config API module).
>
> However, the LLVMConfig.cmake currently provided by LLVM does not
> cleanly distinguish between coming with the build tree v. the install
> tree.  It is also not provided at all by the Makefile-based build
> system.
>
> Here is a patch series to improve the CMake package infrastructure:
>
> * Create separate LLVMConfig.cmake for the build and install trees
>   each with relevant settings when building with CMake.
>
> * Use the CMake export() and install(EXPORT) commands to "export"
>   library target names and dependencies for import into applications.
>   This allows application CMake code to reference LLVM libraries by
>   logical name and CMake will handle mapping to the real library
>   (e.g. "LLVMSupport" => "/path/to/lib/libLLVMSupport.a").
>
>   It also communicates library dependencies (from llvm-build) to
>   applications in a way that CMake builtin features understand.
>   A follow-up to this series will use this feature to avoid explicit
>   handling of dependencies and system libraries in LLVM-Config.cmake.
>
> * Provide LLVMConfig.cmake for the install tree when building with
>   the Makefile-based build system.  This will allow applications
>   to build with CMake using find_package(LLVM) even when LLVM was
>   not built with CMake.
>
> This patch series is based on trunk as of r200018.  It must be
> followed up by a patch made by running 'autoconf/AutoRegen.sh'.
> However, I do not have the versions of the autotools required by
> that script so the 'configure' generated on my machine for local
> testing is not suitable for distribution.
>
> Thanks,
> -Brad
>



More information about the llvm-commits mailing list