diff options
author | Chris Bieneman <beanz@apple.com> | 2016-02-23 20:33:53 +0000 |
---|---|---|
committer | Chris Bieneman <beanz@apple.com> | 2016-02-23 20:33:53 +0000 |
commit | 1a938125ac3c4a605eae0117a6919d4d40e70413 (patch) | |
tree | a579db55de7150fdfbe403b382b6aeaa556152df /CMakeLists.txt | |
parent | 401c43dfc3be17b53fab3be0ef05884ab9d4e9c7 (diff) |
[CMake] Create an install-distribution target driven by LLVM_DISTRIBUTION_COMPONENTS
The idea here is to provide a customizable install target that only depends on building the things you actually want to install. It relies on each component being installed having an auto-generated install-${component}, which in turn depends only on the target being installed.
This is fundamentally a workaround for the fact that CMake generates build files which have their "install" target depend on the "all" target. This results in "ninja install" building a bunch of unneeded things.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261681 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 29eb0016840..3db1d275014 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -766,3 +766,20 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) -P "${CMAKE_BINARY_DIR}/cmake_install.cmake") endif() endif() + +# This must be at the end of the LLVM root CMakeLists file because it must run +# after all targets are created. +if(LLVM_DISTRIBUTION_COMPONENTS) + if(CMAKE_CONFIGURATION_TYPES) + message(FATAL_ERROR "LLVM_DISTRIBUTION_COMPONENTS cannot be specified with multi-configuration generators (i.e. Xcode or Visual Studio)") + endif() + + add_custom_target(install-distribution) + foreach(target ${LLVM_DISTRIBUTION_COMPONENTS}) + if(TARGET install-${target}) + add_dependencies(install-distribution install-${target}) + else() + message(FATAL_ERROR "Specified distribution component '${target}' doesn't have an install target") + endif() + endforeach() +endif() |