Commit Graph

9 Commits

Author SHA1 Message Date
Shoaib Meenai 56f7e5a822 [cmake] Add support for multiple distributions
LLVM's build system contains support for configuring a distribution, but
it can often be useful to be able to configure multiple distributions
(e.g. if you want separate distributions for the tools and the
libraries). Add this support to the build system, along with
documentation and usage examples.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D89177
2021-05-12 11:13:18 -07:00
serge-sans-paille 05c479491c Make it possible for client code to consume CLANG_LINK_CLANG_DYLIB
If a client code wants to consume clang libraries, it needs to know
CLANG_LINK_CLANG_DYLIB value in order to decide whether to use the DYLIB or
individual components.

Differential Revision: https://reviews.llvm.org/D82291
2020-06-30 15:13:53 +02:00
Chris Bieneman 6b5851bb4a [CMake] NFC. Add clang-tablegen-targets utility target
By creating this target other projects that depend on clang-generated headers (like LLDB) will no longer be order-dependent on Clang being processed by CMake first.

Also, by creating a dummy of this target in ClangConfig.cmake, projects that can build against out-of-tree clang can freely depend on the target without needing to have conditionals for if clang is in-tree or out-of-tree.

llvm-svn: 309390
2017-07-28 15:33:47 +00:00
Chris Bieneman c574297de6 [CMake] Add CLANG_INCLUDE_DIRS to CMake exports
This patch adds setting CLANG_INCLUDE_DIRS in the generated CMake package configuration files.

llvm-svn: 294207
2017-02-06 18:17:23 +00:00
Michal Gorny f103c0d7fd [cmake] Hint find_package() to prefer LLVM installed alongside clang
Include a path hint for find_package() in ClangConfig.cmake to ensure
that CMake prefers LLVM installed alongside clang over the default
search path.

If two versions of LLVM are installed in the system, and one of them is
in PATH, CMake's find_package() magic prefers the CMake directory
alongside that install by default. Adding a relative hint makes it
possible to prioritize to the install from which find_package() is
called.

If you want to build e.g. LLDB against another install of LLVM, you can
pass LLVM_CONFIG override. In this case, LLDB queries the prefix from
llvm-config and uses the CMake files located there. However, when
including ClangConfig, the implicit find_package() nevertheless prefers
PATH-found LLVM over the one used previously by LLDB, and two versions
of LLVMConfig end up being loaded.

This could be fixed on LLDB end up by explicitly forcing custom package
search location. However, it seems simpler and safer to add a hint to
ClangConfig than to track every usage of ClangConfig.

Differential Revision: https://reviews.llvm.org/D29304

llvm-svn: 293632
2017-01-31 14:15:40 +00:00
Michael Gottesman a1e6c6cabc [cmake] Remove stale comment. NFC.
llvm-svn: 274212
2016-06-30 05:51:18 +00:00
Michael Gottesman 5ba5270eb9 [ClangConfig] Store all of the targets exported in the variable CLANG_EXPORTED_TARGETS.
llvm-svn: 274180
2016-06-29 21:59:23 +00:00
Michael Gottesman 497e97ffe3 [ClangConfig] Instead of hard coding the ClangTargets location to /ClangTargets.cmake, follow LLVM's example and use a pre-computed cmake variable @CLANG_CONFIG_EXPORTS_FILE@.
This just makes ClangConfig more consistent with LLVMConfig.

llvm-svn: 274178
2016-06-29 21:59:19 +00:00
Michael Gottesman 905426e606 [cmake] Instead of just copying ClangConfig.cmake, configure it using ClangConfig.cmake.in.
This will allow for cmake to expand variables in ClangConfig.cmake for
downstream users.

llvm-svn: 274176
2016-06-29 21:59:14 +00:00