Author: Louis Dionne Date: 2022-08-25T09:03:53+02:00 New Revision: 0cc033e333261bb4b4f7e9689c5fafdc5cc65c23
URL: https://github.com/llvm/llvm-project/commit/0cc033e333261bb4b4f7e9689c5fafdc5cc65c23 DIFF: https://github.com/llvm/llvm-project/commit/0cc033e333261bb4b4f7e9689c5fafdc5cc65c23.diff LOG: [runtimes] Handle interface targets in runtimes distribution components As reported in [1], cxx-headers is not a valid distribution target because it is an interface target in CMake. This breaks the most basic MultiDistributionExample of the runtimes build. This patch handles interface targets by getting rid of the assumption that all distribution components have a target associated to them. It is valid for a distribution component to only have a `install-FOO` target. In the case where only `cxx-headers` is provided as a distribution component, `ninja toolchain-distribution` will not build anything after this patch, since there is effectively nothing to build for the `cxx-headers` target. However, running `ninja install-toolchain-distribution` will build everything, as expected. [1]: https://discord.com/channels/636084430946959380/636732894974312448/1010013287464828968 Differential Revision: https://reviews.llvm.org/D132387 (cherry picked from commit 5905e699342fd476d7eb9e35db5d84248a7e9156) Added: Modified: llvm/cmake/modules/LLVMDistributionSupport.cmake llvm/runtimes/CMakeLists.txt Removed: ################################################################################ diff --git a/llvm/cmake/modules/LLVMDistributionSupport.cmake b/llvm/cmake/modules/LLVMDistributionSupport.cmake index a2fe69df1e7e6..526f36dcda830 100644 --- a/llvm/cmake/modules/LLVMDistributionSupport.cmake +++ b/llvm/cmake/modules/LLVMDistributionSupport.cmake @@ -260,10 +260,10 @@ function(llvm_distribution_add_targets) add_custom_target(install-${distribution_target}-stripped) foreach(target ${distribution_components}) + # Note that some distribution components may not have an actual target, but only an install-FOO target. + # This happens for example if a target is an INTERFACE target. if(TARGET ${target}) add_dependencies(${distribution_target} ${target}) - else() - message(SEND_ERROR "Specified distribution component '${target}' doesn't have a target") endif() if(TARGET install-${target}) diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt index 34fcccab100c5..1ba462c51ae87 100644 --- a/llvm/runtimes/CMakeLists.txt +++ b/llvm/runtimes/CMakeLists.txt @@ -214,7 +214,7 @@ function(runtime_default_target) endforeach() foreach(component ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS}) if(NOT ${component} IN_LIST SUB_COMPONENTS) - list(APPEND extra_targets ${component} install-${component} install-${component}-stripped) + list(APPEND extra_targets install-${component} install-${component}-stripped) endif() endforeach() _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits