[llvm] [LLVM][runtimes] Prepopulate `LLVM_BUILTIN_TARGETS` with runtimes values (PR #95554)

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 17 09:54:49 PDT 2024


================
@@ -138,37 +142,43 @@ endfunction()
 # before the just-built compiler can pass the configuration tests.
 get_compiler_rt_path(compiler_rt_path)
 if(compiler_rt_path)
+  # If the user did not specify the targets infer them from the runtimes.
   if(NOT LLVM_BUILTIN_TARGETS)
+    if("compiler-rt" IN_LIST LLVM_ENABLE_RUNTIMES)
+      list(APPEND LLVM_BUILTIN_TARGETS "default")
+    endif()
+    foreach(name ${LLVM_RUNTIME_TARGETS})
+      if("compiler-rt" IN_LIST RUNTIMES_${name}_LLVM_ENABLE_RUNTIMES)
+        list(APPEND LLVM_BUILTIN_TARGETS ${name})
+      endif()
+    endforeach()
+  endif()
+  if("default" IN_LIST LLVM_BUILTIN_TARGETS)
     builtin_default_target(${compiler_rt_path}
       DEPENDS clang-resource-headers)
+    list(REMOVE_ITEM LLVM_BUILTIN_TARGETS "default")
----------------
petrhosek wrote:

What's the reason for doing this? We shouldn't be modifying global variables controlled by the user.

https://github.com/llvm/llvm-project/pull/95554


More information about the llvm-commits mailing list