CMake: Use libdl only when available. Fixes build on FreeBSD.
authorOscar Fuentes <ofv@wanadoo.es>
Sat, 23 May 2009 02:37:24 +0000 (02:37 +0000)
committerOscar Fuentes <ofv@wanadoo.es>
Sat, 23 May 2009 02:37:24 +0000 (02:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72311 91177308-0d34-0410-b5e6-96231b3b80d8

cmake/config-ix.cmake
cmake/modules/AddLLVM.cmake

index adebb1b38f52bbef2b6f2727ff6a86080af47a8d..0c903a190292c883cf1af9cef13e6672cfeed1fd 100755 (executable)
@@ -42,6 +42,7 @@ check_include_file(windows.h HAVE_WINDOWS_H)
 # library checks
 include(CheckLibraryExists)
 check_library_exists(pthread pthread_create "" HAVE_LIBPTHREAD)
+check_library_exists(dl dlopen "" HAVE_LIBDL)
 
 # function checks
 include(CheckSymbolExists)
index 62d9f3195bb35f6cbe7f6d4124ae660b0e6cc612..1f0ff74c12ce15d255597b12908f42ad435abb86 100755 (executable)
@@ -33,7 +33,9 @@ macro(add_llvm_executable name)
     if( MINGW )
       target_link_libraries(${name} imagehlp psapi)
     elseif( CMAKE_HOST_UNIX )
-      target_link_libraries(${name} dl)
+      if( HAVE_LIBDL )
+       target_link_libraries(${name} dl)
+      endif()
       if( LLVM_ENABLE_THREADS AND HAVE_LIBPTHREAD )
        target_link_libraries(${name} pthread)
       endif()