Skip to content

Commit 0cc033e

Browse files
ldionnetru
authored andcommitted
[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 5905e69)
1 parent d761fe6 commit 0cc033e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

llvm/cmake/modules/LLVMDistributionSupport.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,10 @@ function(llvm_distribution_add_targets)
260260
add_custom_target(install-${distribution_target}-stripped)
261261

262262
foreach(target ${distribution_components})
263+
# Note that some distribution components may not have an actual target, but only an install-FOO target.
264+
# This happens for example if a target is an INTERFACE target.
263265
if(TARGET ${target})
264266
add_dependencies(${distribution_target} ${target})
265-
else()
266-
message(SEND_ERROR "Specified distribution component '${target}' doesn't have a target")
267267
endif()
268268

269269
if(TARGET install-${target})

llvm/runtimes/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ function(runtime_default_target)
214214
endforeach()
215215
foreach(component ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS})
216216
if(NOT ${component} IN_LIST SUB_COMPONENTS)
217-
list(APPEND extra_targets ${component} install-${component} install-${component}-stripped)
217+
list(APPEND extra_targets install-${component} install-${component}-stripped)
218218
endif()
219219
endforeach()
220220

0 commit comments

Comments
 (0)