From aa8dfe9fb311682e52aded7146c6ef16ae6d645e Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Fri, 29 Apr 2016 22:19:35 +0000 Subject: [PATCH] [CMake] [Xcode] Improving Xcode toolchain generation to support distribution targets This adds a new target `install-distribution-toolchain` which will install an Xcode toolchain featuring just the LLVM components specified in LLVM_DISTRIBUTION_COMPONENTS. llvm-svn: 268125 --- llvm/tools/xcode-toolchain/CMakeLists.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/llvm/tools/xcode-toolchain/CMakeLists.txt b/llvm/tools/xcode-toolchain/CMakeLists.txt index 4eacbd320efc..bd70be2ce64d 100644 --- a/llvm/tools/xcode-toolchain/CMakeLists.txt +++ b/llvm/tools/xcode-toolchain/CMakeLists.txt @@ -70,3 +70,23 @@ add_custom_target(install-xcode-toolchain -DCMAKE_INSTALL_PREFIX=${LLVMToolchainDir}/usr/ -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" ${cmake_3_2_USES_TERMINAL}) + +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-toolchain + DEPENDS ${LLVMToolchainDir}/ToolchainInfo.plist distribution) + + foreach(target ${LLVM_DISTRIBUTION_COMPONENTS}) + add_custom_target(install-distribution-${target} + DEPENDS ${target} + COMMAND "${CMAKE_COMMAND}" + -DCMAKE_INSTALL_COMPONENT=${target} + -DCMAKE_INSTALL_PREFIX=${LLVMToolchainDir}/usr/ + -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" + ${cmake_3_2_USES_TERMINAL}) + add_dependencies(install-distribution-toolchain install-distribution-${target}) + endforeach() +endif()