[llvm] r275007 - [cmake] Create the LLVM_BUILD_UTILS option.

Michael Gottesman via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 9 19:43:48 PDT 2016


Author: mgottesman
Date: Sat Jul  9 21:43:47 2016
New Revision: 275007

URL: http://llvm.org/viewvc/llvm-project?rev=275007&view=rev
Log:
[cmake] Create the LLVM_BUILD_UTILS option.

This option is the equivalent option to LLVM_BUILD_TOOLS but for executables
created via add_llvm_utility.

This is a useful tool for improving compile time in situations where LLVM is
used as a library and no testing tools are needed.

It follows the exact same implemention model as LLVM_BUILD_TOOLS.

Since the option is by default set to on, no behavior is changed unless one sets
it from the command line to be false.

Modified:
    llvm/trunk/CMakeLists.txt
    llvm/trunk/cmake/modules/AddLLVM.cmake

Modified: llvm/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=275007&r1=275006&r2=275007&view=diff
==============================================================================
--- llvm/trunk/CMakeLists.txt (original)
+++ llvm/trunk/CMakeLists.txt Sat Jul  9 21:43:47 2016
@@ -391,6 +391,8 @@ option(LLVM_BUILD_TOOLS
   "Build the LLVM tools. If OFF, just generate build targets." ON)
 
 option(LLVM_INCLUDE_UTILS "Generate build targets for the LLVM utils." ON)
+option(LLVM_BUILD_UTILS
+  "Build LLVM utility binaries. If OFF, just generate build targets." ON)
 
 option(LLVM_BUILD_RUNTIME
   "Build the LLVM runtime libraries." ON)

Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=275007&r1=275006&r2=275007&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
+++ llvm/trunk/cmake/modules/AddLLVM.cmake Sat Jul  9 21:43:47 2016
@@ -800,11 +800,16 @@ macro(add_llvm_example name)
   set_target_properties(${name} PROPERTIES FOLDER "Examples")
 endmacro(add_llvm_example name)
 
-
+# This is a macro that is used to create targets for executables that are needed
+# for development, but that are not intended to be installed by default.
 macro(add_llvm_utility name)
+  if ( NOT LLVM_BUILD_UTILS )
+    set(EXCLUDE_FROM_ALL ON)
+  endif()
+
   add_llvm_executable(${name} DISABLE_LLVM_LINK_LLVM_DYLIB ${ARGN})
   set_target_properties(${name} PROPERTIES FOLDER "Utils")
-  if( LLVM_INSTALL_UTILS )
+  if( LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS )
     install (TARGETS ${name}
       RUNTIME DESTINATION bin
       COMPONENT ${name})




More information about the llvm-commits mailing list