[PATCH] D132883: [cmake] Don't include symlinks to tools in Build-all when `LLVM_BUILD_TOOLS` is off

Markus Böck via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 29 13:14:43 PDT 2022


zero9178 created this revision.
zero9178 added reviewers: phosek, Ericson2314, smeenai, sebastian-ne.
Herald added a subscriber: mgorny.
Herald added a reviewer: alexander-shaposhnikov.
Herald added a project: All.
zero9178 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

When building LLVM with `LLVM_BUILD_TOOLS` as OFF, numerous tools such as `llvm-ar` or `llvm-objcopy` end up still being built. The reason for this is that the symlink targets are unconditionally included in a Build-all build, causing the tool they're symlinking to be built after all.

This patch changes that behaviour to be more intuative by only including including the symlink in a Build-all build, if `LLVM_BUILD_TOOLS` is true.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132883

Files:
  llvm/cmake/modules/AddLLVM.cmake


Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -2135,7 +2135,12 @@
     add_custom_command(OUTPUT ${output_path}
                      COMMAND ${CMAKE_COMMAND} -E ${LLVM_LINK_OR_COPY} "${dest_binary}" "${output_path}"
                      DEPENDS ${target})
-    add_custom_target(${target_name} ALL DEPENDS ${target} ${output_path})
+
+    set(should_build_all)
+    if (LLVM_BUILD_TOOLS)
+      set(should_build_all ALL)
+    endif()
+    add_custom_target(${target_name} ${should_build_all} DEPENDS ${target} ${output_path})
     set_target_properties(${target_name} PROPERTIES FOLDER Tools)
 
     # Make sure both the link and target are toolchain tools


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132883.456448.patch
Type: text/x-patch
Size: 798 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220829/7895c958/attachment.bin>


More information about the llvm-commits mailing list