From aec29e5973c27bcbc3c1cf54295e3778050a73cd Mon Sep 17 00:00:00 2001 From: Michael Gottesman Date: Sun, 10 Jul 2016 01:44:00 +0000 Subject: 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@275006 91177308-0d34-0410-b5e6-96231b3b80d8 --- cmake/modules/AddClang.cmake | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'cmake') diff --git a/cmake/modules/AddClang.cmake b/cmake/modules/AddClang.cmake index 121ad29b50..6e063a706b 100644 --- a/cmake/modules/AddClang.cmake +++ b/cmake/modules/AddClang.cmake @@ -121,17 +121,24 @@ macro(add_clang_executable name) endmacro(add_clang_executable) macro(add_clang_tool name) + if (NOT CLANG_BUILD_TOOLS) + set(EXCLUDE_FROM_ALL ON) + endif() + add_clang_executable(${name} ${ARGN}) - install(TARGETS ${name} - RUNTIME DESTINATION bin - COMPONENT ${name}) - - if(NOT CMAKE_CONFIGURATION_TYPES) - add_custom_target(install-${name} - DEPENDS ${name} - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=${name} - -P "${CMAKE_BINARY_DIR}/cmake_install.cmake") + + if (CLANG_BUILD_TOOLS) + install(TARGETS ${name} + RUNTIME DESTINATION bin + COMPONENT ${name}) + + if(NOT CMAKE_CONFIGURATION_TYPES) + add_custom_target(install-${name} + DEPENDS ${name} + COMMAND "${CMAKE_COMMAND}" + -DCMAKE_INSTALL_COMPONENT=${name} + -P "${CMAKE_BINARY_DIR}/cmake_install.cmake") + endif() endif() endmacro() -- cgit v1.2.3