diff --git a/CMakeLists.txt b/CMakeLists.txt index be78ac26f08..931e28e4efc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,6 +60,8 @@ if (NOT PACKAGE_VERSION) "${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) diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake index 50cee302d0e..1bb98a14d49 100644 --- a/cmake/modules/AddLLVM.cmake +++ b/cmake/modules/AddLLVM.cmake @@ -547,6 +547,18 @@ endmacro(add_llvm_example name) 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)