2 # Once done this will define
4 # LIBDL_FOUND - system has libdl
5 # LIBDL_INCLUDE_DIRS - the libdl include directory
6 # LIBDL_LIBRARIES - Link these to use libdl
7 # LIBDL_NEEDS_UNDERSCORE - If extern "C" symbols are prefixed (BSD/Apple)
10 find_path (LIBDL_INCLUDE_DIRS NAMES dlfcn.h)
11 find_library (LIBDL_LIBRARIES NAMES dl)
12 include (FindPackageHandleStandardArgs)
14 FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibDL DEFAULT_MSG
18 SET(CMAKE_REQUIRED_LIBRARIES dl)
19 INCLUDE(CheckCSourceRuns)
20 CHECK_C_SOURCE_RUNS("#include <dlfcn.h>
25 if (dlsym(0, \"_testfunc\") != (void*)0) {
30 }" LIBDL_NEEDS_UNDERSCORE)
32 mark_as_advanced(LIBDL_INCLUDE_DIRS LIBDL_LIBRARIES LIBDL_NEEDS_UNDERSCORE)