https://github.com/bulbazord created 
https://github.com/llvm/llvm-project/pull/208860

LINK_COMPONENTS and CLANG_LIBS exist to correctly support the LLVM/Clang dylib 
build configuration. Failure to enforce this will break LLDB when built against 
libLLVM.dylib.

>From 1fdc705043b7e850aad21071d9a1bc6e745189fd Mon Sep 17 00:00:00 2001
From: Alex Langford <[email protected]>
Date: Fri, 10 Jul 2026 16:51:46 -0700
Subject: [PATCH] [lldb] Enforce usage of LINK_COMPONENTS and CLANG_LIBS

LINK_COMPONENTS and CLANG_LIBS exist to correctly support the LLVM/Clang
dylib build configuration. Failure to enforce this will break LLDB when
built against libLLVM.dylib.
---
 lldb/cmake/modules/AddLLDB.cmake | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/lldb/cmake/modules/AddLLDB.cmake b/lldb/cmake/modules/AddLLDB.cmake
index fb49da3396a5c..b6ad8d46380b3 100644
--- a/lldb/cmake/modules/AddLLDB.cmake
+++ b/lldb/cmake/modules/AddLLDB.cmake
@@ -188,6 +188,22 @@ function(add_lldb_library name)
     "LINK_LIBS;CLANG_LIBS;ALLOWED_INTERNAL_DEPENDENCIES"
     ${ARGN})
 
+  foreach(link_lib ${PARAM_LINK_LIBS})
+    # May not be a target yet.
+    if (NOT TARGET ${link_lib})
+      continue()
+    endif()
+
+    if (link_lib MATCHES "^clang")
+      message(FATAL_ERROR "Library ${name} links against clang library 
${link_lib} via LINK_LIBS but must be added via CLANG_LIBS")
+    endif()
+
+    get_target_property(_is_llvm_component ${link_lib} LLVM_COMPONENT)
+    if (link_lib MATCHES "^LLVM" AND ${_is_llvm_component})
+      message(FATAL_ERROR "Library ${name} links against LLVM library 
${link_lib} via LINK_LIBS but must be added via LINK_COMPONENTS")
+    endif()
+  endforeach()
+
   set(_check_internal_deps FALSE)
   if(PARAM_NO_INTERNAL_DEPENDENCIES)
     set(_allowed_internal_deps "")

_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to