forked from OSchip/llvm-project
[cmake] Don't include symlinks to tools in Build-all when `LLVM_BUILD_TOOLS` is off
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 intuitive by only including the symlink in a Build-all build if the target they're linking to is also included. Differential Revision: https://reviews.llvm.org/D132883
This commit is contained in:
parent
23a5de4294
commit
52d7c0b760
|
@ -2135,7 +2135,14 @@ function(llvm_add_tool_symlink project link_name target)
|
|||
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})
|
||||
|
||||
# TODO: Make use of generator expressions below once CMake 3.19 or higher is the minimum supported version.
|
||||
set(should_build_all)
|
||||
get_target_property(target_excluded_from_all ${target} EXCLUDE_FROM_ALL)
|
||||
if (NOT target_excluded_from_all)
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue