summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorChris Dyer <cdyer@vivace.clab.cs.cmu.edu>2015-03-04 22:46:33 -0500
committerChris Dyer <cdyer@vivace.clab.cs.cmu.edu>2015-03-04 22:46:33 -0500
commit42e6a2888f986b062c6391b6bef6ef817c6b8a68 (patch)
treefa5c9828928adf5a025575082e911c42a7019105 /cmake
parent3d2a60701f053fc35130711e88d9fcb29f29e274 (diff)
deal with libdl
Diffstat (limited to 'cmake')
-rw-r--r--cmake/FindLibDL.cmake30
1 files changed, 30 insertions, 0 deletions
diff --git a/cmake/FindLibDL.cmake b/cmake/FindLibDL.cmake
new file mode 100644
index 00000000..1689e4c7
--- /dev/null
+++ b/cmake/FindLibDL.cmake
@@ -0,0 +1,30 @@
+# - Find libdl
+# Find the native LIBDL includes and library
+#
+# LIBDL_INCLUDE_DIR - where to find dlfcn.h, etc.
+# LIBDL_LIBRARIES - List of libraries when using libdl.
+# LIBDL_FOUND - True if libdl found.
+
+
+IF (LIBDL_INCLUDE_DIR)
+ # Already in cache, be silent
+ SET(LIBDL_FIND_QUIETLY TRUE)
+ENDIF (LIBDL_INCLUDE_DIR)
+
+FIND_PATH(LIBDL_INCLUDE_DIR dlfcn.h)
+
+SET(LIBDL_NAMES dl libdl ltdl libltdl)
+FIND_LIBRARY(LIBDL_LIBRARY NAMES ${LIBDL_NAMES} )
+
+# handle the QUIETLY and REQUIRED arguments and set LIBDL_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibDL DEFAULT_MSG LIBDL_LIBRARY LIBDL_INCLUDE_DIR)
+
+IF(LIBDL_FOUND)
+ SET( LIBDL_LIBRARIES ${LIBDL_LIBRARY} )
+ELSE(LIBDL_FOUND)
+ SET( LIBDL_LIBRARIES )
+ENDIF(LIBDL_FOUND)
+
+MARK_AS_ADVANCED( LIBDL_LIBRARY LIBDL_INCLUDE_DIR )