endif()
endfunction()
+function(add_llvm_install_targets target)
+ cmake_parse_arguments(ARG "" "COMPONENT;PREFIX" "DEPENDS" ${ARGN})
+ if(ARG_COMPONENT)
+ set(component_option -DCMAKE_INSTALL_COMPONENT="${ARG_COMPONENT}")
+ endif()
+ if(ARG_PREFIX)
+ set(prefix_option -DCMAKE_INSTALL_PREFIX="${ARG_PREFIX}")
+ endif()
+
+ add_custom_target(${target}
+ DEPENDS ${ARG_DEPENDS}
+ COMMAND "${CMAKE_COMMAND}"
+ ${component_option}
+ ${prefix_option}
+ -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
+ USES_TERMINAL)
+ add_custom_target(${target}-stripped
+ DEPENDS ${ARG_DEPENDS}
+ COMMAND "${CMAKE_COMMAND}"
+ ${component_option}
+ ${prefix_option}
+ -DCMAKE_INSTALL_DO_STRIP=1
+ -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
+ USES_TERMINAL)
+endfunction()
+
macro(add_llvm_library name)
cmake_parse_arguments(ARG
"SHARED;BUILDTREE_ONLY"
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")
+ add_llvm_install_targets(install-${name}
+ DEPENDS ${name}
+ COMPONENT ${name})
endif()
endif()
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
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")
+ add_llvm_install_targets(install-${name}
+ DEPENDS ${name}
+ COMPONENT ${name})
endif()
endif()
endif()
RUNTIME DESTINATION ${LLVM_UTILS_INSTALL_DIR}
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")
+ add_llvm_install_targets(install-${name}
+ DEPENDS ${name}
+ COMPONENT ${name})
endif()
endif()
endmacro(add_llvm_utility name)
COMPONENT ${component})
if (NOT CMAKE_CONFIGURATION_TYPES AND NOT ARG_ALWAYS_GENERATE)
- add_custom_target(install-${name}
- DEPENDS ${name} ${dest} install-${dest}
- COMMAND "${CMAKE_COMMAND}"
- -DCMAKE_INSTALL_COMPONENT=${name}
- -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
+ add_llvm_install_targets(install-${name}
+ DEPENDS ${name} ${dest} install-${dest}
+ COMPONENT ${name})
endif()
endfunction()
COMPONENT ${component})
if (NOT CMAKE_CONFIGURATION_TYPES AND NOT ARG_ALWAYS_GENERATE)
- add_custom_target(install-${name}
- DEPENDS ${name} ${dest} install-${dest}
- COMMAND "${CMAKE_COMMAND}"
- -DCMAKE_INSTALL_COMPONENT=${name}
- -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
+ add_llvm_install_targets(install-${name}
+ DEPENDS ${name} ${dest} install-${dest}
+ COMPONENT ${name})
endif()
endfunction()
COMMAND /usr/libexec/PlistBuddy -c "Add:CompatibilityVersion integer ${COMPAT_VERSION}" "${LLVMToolchainDir}/Info.plist"
)
-add_custom_target(install-xcode-toolchain
- DEPENDS ${LLVMToolchainDir}/Info.plist
- COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target all
- COMMAND "${CMAKE_COMMAND}"
- -DCMAKE_INSTALL_PREFIX=${LLVMToolchainDir}/usr/
- -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
- USES_TERMINAL)
+add_custom_target(build-xcode-toolchain
+ COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target all)
+add_llvm_install_targets(install-xcode-toolchain
+ DEPENDS ${LLVMToolchainDir}/Info.plist build-xcode-toolchain
+ PREFIX ${LLVMToolchainDir}/usr/)
if(LLVM_DISTRIBUTION_COMPONENTS)
if(CMAKE_CONFIGURATION_TYPES)
DEPENDS ${LLVMToolchainDir}/Info.plist distribution)
foreach(target ${LLVM_DISTRIBUTION_COMPONENTS})
- add_custom_target(install-distribution-${target}
- DEPENDS ${target}
- COMMAND "${CMAKE_COMMAND}"
- -DCMAKE_INSTALL_COMPONENT=${target}
- -DCMAKE_INSTALL_PREFIX=${LLVMToolchainDir}/usr/
- -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
- USES_TERMINAL)
+ add_llvm_install_targets(install-distribution-${target}
+ DEPENDS ${target}
+ COMPONENT ${target}
+ PREFIX ${LLVMToolchainDir}/usr/)
add_dependencies(install-distribution-toolchain install-distribution-${target})
endforeach()
endif()