CMake: Use libdl only when available. Fixes build on FreeBSD.

llvm-svn: 72311
This commit is contained in:
Oscar Fuentes 2009-05-23 02:37:24 +00:00
parent 77529302a6
commit 2468ff90c0
2 changed files with 4 additions and 1 deletions

View File

@ -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)

View File

@ -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()