[clang] 30ad481 - Revert "cmake: use llvm dir variables for clang/utils/hmaptool"

Nikita Popov via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 2 05:56:29 PDT 2022


Author: Nikita Popov
Date: 2022-06-02T14:55:58+02:00
New Revision: 30ad481e87ca7cd2250bd5771ab66ddfe623eb10

URL: https://github.com/llvm/llvm-project/commit/30ad481e87ca7cd2250bd5771ab66ddfe623eb10
DIFF: https://github.com/llvm/llvm-project/commit/30ad481e87ca7cd2250bd5771ab66ddfe623eb10.diff

LOG: Revert "cmake: use llvm dir variables for clang/utils/hmaptool"

As discussed on the review, this change breaks the standalone
clang build. When building against an installed LLVM, the
LLVM_TOOLS_BINARY_DIR cmake variable points to the location of
the installed LLVM tools, not to the cmake build directory. This
means that we would end up trying to move hmaptool into something
like /usr/bin as part of the normal build, while this should only
be happening when running an install target.

This reverts commit bf1ab1f0eb9578914343f48096229ecccd0ecf52.

Added: 
    

Modified: 
    clang/utils/hmaptool/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/clang/utils/hmaptool/CMakeLists.txt b/clang/utils/hmaptool/CMakeLists.txt
index 01b6a920fb94..f0d9866782b8 100644
--- a/clang/utils/hmaptool/CMakeLists.txt
+++ b/clang/utils/hmaptool/CMakeLists.txt
@@ -1,9 +1,19 @@
-add_custom_command(OUTPUT "${LLVM_TOOLS_BINARY_DIR}/hmaptool"
-                   COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/hmaptool" "${LLVM_TOOLS_BINARY_DIR}"
-                   DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/hmaptool")
+set(CLANG_HMAPTOOL hmaptool)
 
-install(PROGRAMS hmaptool DESTINATION "${LLVM_TOOLS_INSTALL_DIR}" COMPONENT hmaptool)
-add_custom_target(hmaptool ALL DEPENDS "${LLVM_TOOLS_BINARY_DIR}/hmaptool")
+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})
+
+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})
 set_target_properties(hmaptool PROPERTIES FOLDER "Utils")
 
 if(NOT LLVM_ENABLE_IDE)


        


More information about the cfe-commits mailing list