[PATCH] CMake: enable installing utils

Mircea Trofin mtrofin at google.com
Wed Mar 25 14:23:58 PDT 2015


Wrapped the custom install target


http://reviews.llvm.org/D8587

Files:
  CMakeLists.txt
  cmake/modules/AddLLVM.cmake

Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -60,6 +60,8 @@
     "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX}")
 endif()
 
+option(LLVM_INSTALL_UTILS "Include utility binaries in the 'install' target." OFF)
+
 option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install' target." OFF)
 
 option(LLVM_USE_FOLDERS "Enable solution folders in Visual Studio. Disable for Express versions." ON)
Index: cmake/modules/AddLLVM.cmake
===================================================================
--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -547,6 +547,18 @@
 macro(add_llvm_utility name)
   add_llvm_executable(${name} ${ARGN})
   set_target_properties(${name} PROPERTIES FOLDER "Utils")
+  if( LLVM_INSTALL_UTILS )
+    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(add_llvm_utility name)

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8587.22678.patch
Type: text/x-patch
Size: 1355 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150325/de1200b7/attachment.bin>


More information about the llvm-commits mailing list