Improving support for CMake-based applications

Brad King brad.king at kitware.com
Fri Jan 24 12:44:39 PST 2014


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-CMake-De-duplicate-references-to-share-llvm-cmake-pa.patch
Type: text/x-diff
Size: 1464 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140124/301c4a6e/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-CMake-Teach-LLVMConfig-to-avoid-modifying-CMAKE_MODU.patch
Type: text/x-diff
Size: 2634 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140124/301c4a6e/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-CMake-Provide-LLVMConfig-in-both-build-and-install-t.patch
Type: text/x-diff
Size: 5250 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140124/301c4a6e/attachment-0002.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-CMake-Export-lib-and-exe-build-target-names-from-ins.patch
Type: text/x-diff
Size: 3302 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140124/301c4a6e/attachment-0003.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-CMake-Export-lib-and-exe-build-target-names-from-bui.patch
Type: text/x-diff
Size: 3056 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140124/301c4a6e/attachment-0004.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-CMake-Load-exported-lib-and-exe-targets-from-LLVMCon.patch
Type: text/x-diff
Size: 2416 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140124/301c4a6e/attachment-0005.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0007-Makefile-Add-version-arch-system-libs-and-targets-to.patch
Type: text/x-diff
Size: 6935 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140124/301c4a6e/attachment-0006.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0008-Makefile-Provide-CMake-package-modules-in-install-tr.patch
Type: text/x-diff
Size: 12447 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140124/301c4a6e/attachment-0007.patch>


More information about the llvm-commits mailing list