1 # From licq www.licq.org (GPL)
2 # - Find library containing dlopen()
3 # The following variables are set if dlopen is found. If dlopen is not
4 # found, Dlopen_FOUND is set to false.
5 # Dlopen_FOUND - System has dlopen.
6 # Dlopen_LIBRARIES - Link these to use dlopen.
8 # Copyright (c) 2007 Erik Johansson <erik@ejohansson.se>
9 # Redistribution and use is allowed according to the terms of the BSD license.
12 if (NOT Dlopen_SEARCHED)
13 include(CheckLibraryExists)
15 set(Dlopen_SEARCHED TRUE CACHE INTERNAL "")
16 set(Dlopen_FOUND FALSE CACHE INTERNAL "")
18 foreach (library c c_r dl)
20 check_library_exists(${library} dlopen "" Dlopen_IN_${library})
22 if (Dlopen_IN_${library})
23 set(Dlopen_LIBRARIES ${library} CACHE STRING "Library containing dlopen")
24 set(Dlopen_FOUND TRUE CACHE INTERNAL "")
25 endif (Dlopen_IN_${library})
27 endif (NOT Dlopen_FOUND)
31 if (NOT Dlopen_FIND_QUIETLY)
32 message(STATUS "Found dlopen in: ${Dlopen_LIBRARIES}")
33 endif (NOT Dlopen_FIND_QUIETLY)
35 if (Dlopen_FIND_REQUIRED)
36 message(FATAL_ERROR "Could not find the library containing dlopen")
37 endif (Dlopen_FIND_REQUIRED)
40 mark_as_advanced(Dlopen_LIBRARIES)
41 endif(NOT Dlopen_SEARCHED)