[Openmp-commits] [PATCH] D34632: Check for libdl, and only use it when available

Dimitry Andric via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Jun 26 10:32:41 PDT 2017


dim created this revision.
Herald added a subscriber: mgorny.

On BSDs, there is no `libdl.so`, and functions like `dlopen` are implemented in the main C library instead. Check for the existence of `libdl` in the main CMakeLists.txt file, and only use it if it exists.


Repository:
  rL LLVM

https://reviews.llvm.org/D34632

Files:
  libomptarget/CMakeLists.txt


Index: libomptarget/CMakeLists.txt
===================================================================
--- libomptarget/CMakeLists.txt
+++ libomptarget/CMakeLists.txt
@@ -94,8 +94,11 @@
   
   # Build libomptarget library with libdl dependency.
   add_library(omptarget SHARED ${src_files})
+  check_library_exists(dl dlopen "" HAVE_LIBDL)
+  if(HAVE_LIBDL)
+    target_link_libraries(omptarget dl)
+  endif()
   target_link_libraries(omptarget
-    dl
     "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports")
   
   # Install libomptarget under the lib destination folder.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34632.103988.patch
Type: text/x-patch
Size: 582 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20170626/aad0df75/attachment.bin>


More information about the Openmp-commits mailing list