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