[PATCH] D80492: Avoid linking libdl unless needed

Tobias Hieta via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun May 24 10:08:34 PDT 2020


thieta created this revision.
thieta added a reviewer: mstorsjo.
thieta added a project: clang.
Herald added subscribers: cfe-commits, mgorny.

This fixes cross-compilation when targeting a platform not using libdl and mirrors libdl linking in other parts of the code.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80492

Files:
  clang/tools/libclang/CMakeLists.txt


Index: clang/tools/libclang/CMakeLists.txt
===================================================================
--- clang/tools/libclang/CMakeLists.txt
+++ clang/tools/libclang/CMakeLists.txt
@@ -66,9 +66,8 @@
   endif ()
 endif ()
 
-find_library(DL_LIBRARY_PATH dl)
-if (DL_LIBRARY_PATH)
-  list(APPEND LIBS dl)
+if (HAVE_LIBDL)
+  list(APPEND LIBS ${CMAKE_DL_LIBS})
 endif()
 
 option(LIBCLANG_BUILD_STATIC


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80492.265934.patch
Type: text/x-patch
Size: 409 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200524/c6dcb366/attachment-0001.bin>


More information about the cfe-commits mailing list