Skip to content
This repository was archived by the owner on Aug 31, 2019. It is now read-only.

Commit aec29e5

Browse files
committed
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
1 parent 56c01b3 commit aec29e5

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,9 @@ endif()
342342

343343
add_definitions( -D_GNU_SOURCE )
344344

345+
option(CLANG_BUILD_TOOLS
346+
"Build the Clang tools. If OFF, just generate build targets." ON)
347+
345348
option(CLANG_ENABLE_ARCMT "Build ARCMT." ON)
346349
if (CLANG_ENABLE_ARCMT)
347350
set(ENABLE_CLANG_ARCMT "1")

cmake/modules/AddClang.cmake

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,17 +121,24 @@ macro(add_clang_executable name)
121121
endmacro(add_clang_executable)
122122

123123
macro(add_clang_tool name)
124+
if (NOT CLANG_BUILD_TOOLS)
125+
set(EXCLUDE_FROM_ALL ON)
126+
endif()
127+
124128
add_clang_executable(${name} ${ARGN})
125-
install(TARGETS ${name}
126-
RUNTIME DESTINATION bin
127-
COMPONENT ${name})
128-
129-
if(NOT CMAKE_CONFIGURATION_TYPES)
130-
add_custom_target(install-${name}
131-
DEPENDS ${name}
132-
COMMAND "${CMAKE_COMMAND}"
133-
-DCMAKE_INSTALL_COMPONENT=${name}
134-
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
129+
130+
if (CLANG_BUILD_TOOLS)
131+
install(TARGETS ${name}
132+
RUNTIME DESTINATION bin
133+
COMPONENT ${name})
134+
135+
if(NOT CMAKE_CONFIGURATION_TYPES)
136+
add_custom_target(install-${name}
137+
DEPENDS ${name}
138+
COMMAND "${CMAKE_COMMAND}"
139+
-DCMAKE_INSTALL_COMPONENT=${name}
140+
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
141+
endif()
135142
endif()
136143
endmacro()
137144

0 commit comments

Comments
 (0)