5 # Find the native realtime includes and library.
10 # This module defines :prop_tgt:`IMPORTED` target ``LIBDL::LIBDL``, if
11 # LIBDL has been found.
16 # This module defines the following variables:
20 # LIBDL_INCLUDE_DIRS - where to find dlfcn.h, etc.
21 # LIBDL_LIBRARIES - List of libraries when using libdl.
22 # LIBDL_FOUND - True if dynamic linking library found.
27 # A user may set ``LIBDL_ROOT`` to a library installation root to tell this
28 # module where to look.
30 find_path(LIBDL_INCLUDE_DIRS
32 PATHS ${LIBDL_ROOT}/include/
34 find_library(LIBDL_LIBRARIES dl)
35 include(FindPackageHandleStandardArgs)
36 find_package_handle_standard_args(LibDl DEFAULT_MSG LIBDL_LIBRARIES LIBDL_INCLUDE_DIRS)
37 mark_as_advanced(LIBDL_INCLUDE_DIRS LIBDL_LIBRARIES)
40 if(NOT TARGET LIBDL::LIBDL)
41 add_library(LIBDL::LIBDL UNKNOWN IMPORTED)
42 set_target_properties(LIBDL::LIBDL PROPERTIES
43 IMPORTED_LOCATION "${LIBDL_LIBRARIES}"
44 INTERFACE_INCLUDE_DIRECTORIES "${LIBDL_INCLUDE_DIRS}")