r275006 - Add CLANG_BUILD_TOOLS as a clang counterpart for LLVM_BUILD_TOOLS
Michael Gottesman via cfe-commits
cfe-commits at lists.llvm.org
Sat Jul 9 18:44:01 PDT 2016
Author: mgottesman
Date: Sat Jul 9 20:44:00 2016
New Revision: 275006
URL: http://llvm.org/viewvc/llvm-project?rev=275006&view=rev
Log:
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.
Modified:
cfe/trunk/CMakeLists.txt
cfe/trunk/cmake/modules/AddClang.cmake
Modified: cfe/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=275006&r1=275005&r2=275006&view=diff
==============================================================================
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Sat Jul 9 20:44:00 2016
@@ -342,6 +342,9 @@ endif()
add_definitions( -D_GNU_SOURCE )
+option(CLANG_BUILD_TOOLS
+ "Build the Clang tools. If OFF, just generate build targets." ON)
+
option(CLANG_ENABLE_ARCMT "Build ARCMT." ON)
if (CLANG_ENABLE_ARCMT)
set(ENABLE_CLANG_ARCMT "1")
Modified: cfe/trunk/cmake/modules/AddClang.cmake
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/modules/AddClang.cmake?rev=275006&r1=275005&r2=275006&view=diff
==============================================================================
--- cfe/trunk/cmake/modules/AddClang.cmake (original)
+++ cfe/trunk/cmake/modules/AddClang.cmake Sat Jul 9 20:44:00 2016
@@ -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()
More information about the cfe-commits
mailing list