[clang] [cmake] Respect CLANG_LINK_CLANG_DYLIB for objlibs (PR #93454)

Chris B via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 5 14:56:31 PDT 2024


================
@@ -194,18 +194,20 @@ macro(add_clang_symlink name dest)
 endmacro()
 
 function(clang_target_link_libraries target type)
-  if (TARGET obj.${target})
-    target_link_libraries(obj.${target} ${ARGN})
-  endif()
-
   get_property(LLVM_DRIVER_TOOLS GLOBAL PROPERTY LLVM_DRIVER_TOOLS)
   if(LLVM_TOOL_LLVM_DRIVER_BUILD AND ${target} IN_LIST LLVM_DRIVER_TOOLS)
     set(target llvm-driver)
   endif()
 
   if (CLANG_LINK_CLANG_DYLIB)
     target_link_libraries(${target} ${type} clang-cpp)
+    if (TARGET obj.${target})
+      target_link_libraries(obj.${target} clang-cpp)
+    endif()
   else()
     target_link_libraries(${target} ${type} ${ARGN})
+    if (TARGET obj.${target})
+      target_link_libraries(obj.${target} ${ARGN})
----------------
llvm-beanz wrote:

```suggestion
      target_link_libraries(obj.${target} INTERFACE ${ARGN})
```

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


More information about the cfe-commits mailing list