Skip to content

Commit ed3e007

Browse files
authored
[CMake] Create generic runtimes targets as needed (#76096)
We currently create a generic runtime target for all subbuilds. For example if we're building libcxx for aarch64-linux-gnu and x86_64-linux-gnu, we would create the cxx target that would depend on cxx-aarch64-linux-gnu and cxx-x86_64-linux-gnu. The current implementation creates the generic runtimes targets ahead of time which introduces an issue where different subbuilds enable different runtimes. We should instead create the generic targets as needed.
1 parent 214b434 commit ed3e007

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

llvm/runtimes/CMakeLists.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,17 @@ function(runtime_register_target name)
391391
add_dependencies(runtimes-test-depends runtimes-test-depends-${name})
392392
endif()
393393
foreach(runtime_name ${runtime_names})
394+
if(NOT TARGET ${runtime_name})
395+
add_custom_target(${runtime_name})
396+
endif()
394397
add_dependencies(${runtime_name} ${runtime_name}-${name})
398+
if(NOT TARGET install-${runtime_name})
399+
add_custom_target(install-${runtime_name})
400+
endif()
395401
add_dependencies(install-${runtime_name} install-${runtime_name}-${name})
402+
if(NOT TARGET install-${runtime_name}-stripped)
403+
add_custom_target(install-${runtime_name}-stripped)
404+
endif()
396405
add_dependencies(install-${runtime_name}-stripped install-${runtime_name}-${name}-stripped)
397406
endforeach()
398407
foreach(component ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS})
@@ -459,11 +468,6 @@ if(runtimes)
459468
add_custom_target(runtimes-test-depends)
460469
set(test_targets "")
461470
endif()
462-
foreach(runtime_name ${RUNTIME_NAMES})
463-
add_custom_target(${runtime_name})
464-
add_custom_target(install-${runtime_name})
465-
add_custom_target(install-${runtime_name}-stripped)
466-
endforeach()
467471
if(LLVM_RUNTIME_DISTRIBUTION_COMPONENTS)
468472
foreach(component ${LLVM_RUNTIME_DISTRIBUTION_COMPONENTS})
469473
add_custom_target(${component})

0 commit comments

Comments
 (0)