llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: None (ur4t)

<details>
<summary>Changes</summary>

If CLANG_LINK_CLANG_DYLIB is enabled, link clang shared libraries, otherwise 
follow old behaviours.


---
Full diff: https://github.com/llvm/llvm-project/pull/187857.diff


2 Files Affected:

- (modified) clang/tools/c-index-test/CMakeLists.txt (+3) 
- (modified) clang/tools/libclang/CMakeLists.txt (+5-3) 


``````````diff
diff --git a/clang/tools/c-index-test/CMakeLists.txt 
b/clang/tools/c-index-test/CMakeLists.txt
index 56b4d1fe20699..eda39ebf57ac4 100644
--- a/clang/tools/c-index-test/CMakeLists.txt
+++ b/clang/tools/c-index-test/CMakeLists.txt
@@ -25,6 +25,9 @@ else()
   target_link_libraries(c-index-test
     PRIVATE
     libclang
+  )
+  clang_target_link_libraries(c-index-test
+    PRIVATE
     clangAST
     clangBasic
     clangDriver
diff --git a/clang/tools/libclang/CMakeLists.txt 
b/clang/tools/libclang/CMakeLists.txt
index 09322a424f488..1d1f3d996b71a 100644
--- a/clang/tools/libclang/CMakeLists.txt
+++ b/clang/tools/libclang/CMakeLists.txt
@@ -74,11 +74,11 @@ set(LIBS
 )
 
 if (HAVE_LIBDL)
-  list(APPEND LIBS ${CMAKE_DL_LIBS})
+  set(DL_LIBS ${CMAKE_DL_LIBS})
 elseif (CLANG_BUILT_STANDALONE)
   find_library(DL_LIBRARY_PATH dl)
   if (DL_LIBRARY_PATH)
-    list(APPEND LIBS dl)
+    set(DL_LIBS dl)
   endif ()
 endif ()
 
@@ -142,7 +142,7 @@ add_clang_library(libclang ${ENABLE_SHARED} 
${ENABLE_STATIC} INSTALL_WITH_TOOLCH
   clang-resource-headers
 
   LINK_LIBS
-  ${LIBS}
+  ${DL_LIBS}
 
   LINK_COMPONENTS
   ${LLVM_TARGETS_TO_BUILD}
@@ -151,6 +151,8 @@ add_clang_library(libclang ${ENABLE_SHARED} 
${ENABLE_STATIC} INSTALL_WITH_TOOLCH
   TargetParser
   )
 
+clang_target_link_libraries(libclang PRIVATE ${LIBS})
+
 if(ENABLE_STATIC)
   foreach(name libclang obj.libclang libclang_static)
     if (TARGET ${name})

``````````

</details>


https://github.com/llvm/llvm-project/pull/187857
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to