cmake: use llvm dir variables for clang/utils/hmaptool

Copy hmaptool using the paths for CURRENT_TOOLS_DIR, so
everything goes in the right place in case llvm is included
from a top level CMakeLists.txt.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>

Reviewed By: stephenneuendorffer

Differential Revision: https://reviews.llvm.org/D126308
This commit is contained in:
Matheus Izvekov 2022-05-24 18:21:34 +02:00
parent afbe3aed49
commit 51608515fa
No known key found for this signature in database
GPG Key ID: AD053BA6F28D6A7B
1 changed files with 9 additions and 14 deletions

View File

@ -1,19 +1,14 @@
set(CLANG_HMAPTOOL hmaptool)
# FIXME: ideally we would just provide CURRENT_TOOLS_DIR globally instead of
# computing it just for function(configure_lit_site_cfg)
set_llvm_build_mode()
string(REPLACE "${CMAKE_CFG_INTDIR}" "${LLVM_BUILD_MODE}" CURRENT_TOOLS_DIR "${LLVM_RUNTIME_OUTPUT_INTDIR}")
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HMAPTOOL}
COMMAND ${CMAKE_COMMAND} -E make_directory
${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/${CLANG_HMAPTOOL}
${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${CLANG_HMAPTOOL})
add_custom_command(OUTPUT "${CURRENT_TOOLS_DIR}/hmaptool"
COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/hmaptool" "${CURRENT_TOOLS_DIR}"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/hmaptool")
list(APPEND Depends ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HMAPTOOL})
install(PROGRAMS ${CLANG_HMAPTOOL}
DESTINATION "${CMAKE_INSTALL_BINDIR}"
COMPONENT hmaptool)
add_custom_target(hmaptool ALL DEPENDS ${Depends})
install(PROGRAMS hmaptool DESTINATION "${LLVM_TOOLS_INSTALL_DIR}" COMPONENT hmaptool)
add_custom_target(hmaptool ALL DEPENDS "${CURRENT_TOOLS_DIR}/hmaptool")
set_target_properties(hmaptool PROPERTIES FOLDER "Utils")
if(NOT LLVM_ENABLE_IDE)