Commit Graph

13 Commits

Author SHA1 Message Date
Michael Gottesman eb396a6cbf Add CLANG_BUILD_TOOLS as a clang counterpart for LLVM_BUILD_TOOLS
LLVM_BUILD_TOOLS is a boolean variable that controls whether or not generated
targets for llvm tools are built by the "all" target. CLANG_BUILD_TOOLS is an
analogous variable for clang targets.

This is useful functionality for selectively disabling the building of clang
targets by default to speed up builds.

In terms of implementation, I just followed the model of LLVM's implementation
of this functionality.

llvm-svn: 275006
2016-07-10 01:44:00 +00:00
Michael Gottesman ca589ccb02 Move add_clang_* entry points from the main clang CMakeLists.txt to cmake/modules/AddClang.cmake.
This matches how LLVM has its cmake files organized and is cleaner than just
shoving this business logic into the main CMakeLists.txt.

llvm-svn: 274992
2016-07-09 21:58: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 ccc31a173e [ClangConfig] Unset some variables after we are done using them to configure ClangConfig.cmake.in files.
This ensures that the values do not bleed over in between computations. It may
make sense in the future to just refactor this code into functions to provide
"true scoping".

llvm-svn: 274179
2016-06-29 21:59:20 +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 1b87cd3974 [ClangConfig] Follow LLVM's example and only install Clang{Config,Target}.cmake when LLVM_INSTALL_TOOLCHAIN_ONLY is disabled.
llvm-svn: 274177
2016-06-29 21:59:15 +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
Michael Gottesman 03c38af109 [ClangConfig] Copy ClangConfig.cmake to ${CMAKE_BINARY_DIR}/${CLANG_INSTALL_PACKAGE_DIR} instead of to ${CLANG_BINARY_DIR}/${CLANG_INSTALL_PACKAGE_DIR}.
This is an obvious bug since ClangConfig.cmake looks for ClangTargets.cmake in
${CMAKE_CURRENT_LIST_DIR}. But ClangTargets.cmake is in
${CMAKE_BINARY_DIR}/${CLANG_INSTALL_PACKAGE_DIR}, so it will always fail with an
in tree build.

In the case where clang is built out of tree, this is still correct since
CMAKE_BINARY_DIR and CLANG_BINARY_DIR will be the same.

llvm-svn: 274168
2016-06-29 21:12:38 +00:00
Michael Gottesman 3f5275e8ed [ClangConfig] Replace paths with the same value as CLANG_INSTALL_PACKAGE_DIR with a deref of the variable.
llvm-svn: 274158
2016-06-29 20:22:46 +00:00
Michael Gottesman fe9d2d81f6 [cmake] Move creation of ClangTargets and installation of ClangConfig.cmake from ./CMakeLists.txt -> ./cmake/modules/CMakeLists.txt.
This matches LLVM.

llvm-svn: 274157
2016-06-29 20:22:44 +00:00
Reid Kleckner a2550e68a5 Add call to find_package to load LLVM dependencies
ClangConfig requires LLVMConfig, so add find_package call in
ClangConfig so find_package(clang REQUIRED CONFIG) will just work.  This
makes it easier for cmake based projects to use clang, e.g., tools using
ClangTooling.

Patch by Don Hinton

Differential Revision: http://reviews.llvm.org/D13622

llvm-svn: 261290
2016-02-19 00:56:56 +00:00
Reid Kleckner ed8bca4f42 Make it easier to build against a pre-built Clang package with CMake
Installing <prefix>/share/clang/cmake/ClangConfig.cmake makes CMake's
builtin find_package() utility work with Clang. This also allows
downstream consumers of Clang to statically link against libraries like
clangAST and have that pull in dependencies like clangBasic and
LLVMSupport.

See the CMake docs on packages:
http://www.cmake.org/cmake/help/v3.0/manual/cmake-packages.7.html

llvm-svn: 221411
2014-11-05 23:14:59 +00:00