Merge branch 'master' into new-parallel-parsing
[dyninst.git] / cmake / Modules / FindLibDwarf.cmake
1 # - Try to find libdwarf
2 # Once done this will define
3 #
4 #  LIBDWARF_FOUND - system has libdwarf
5 #  LIBDWARF_INCLUDE_DIRS - the libdwarf include directory
6 #  LIBDWARF_LIBRARIES - Link these to use libdwarf
7 #  LIBDWARF_DEFINITIONS - Compiler switches required for using libdwarf
8 #
9
10
11 if (LIBDWARF_LIBRARIES AND LIBDWARF_INCLUDE_DIRS)
12   set (LibDwarf_FIND_QUIETLY TRUE)
13 endif (LIBDWARF_LIBRARIES AND LIBDWARF_INCLUDE_DIRS)
14
15 find_path (LIBDWARF_INCLUDE_DIR
16   NAMES
17   elfutils/libdw.h
18   HINTS
19   ${LIBDWARF_INCLUDE_DIRS}
20   PATHS
21   /usr/include
22   /usr/local/include
23   /opt/local/include
24   /sw/include
25   ENV CPATH) # PATH and INCLUDE will also work
26
27 find_library (LIBDWARF_LIBRARIES
28   NAMES
29   dw
30   HINTS
31   ${LIBDWARF_LIBRARIES}
32   PATHS
33   /usr/lib
34   /usr/lib64
35   /usr/local/lib
36   /usr/local/lib64
37   /opt/local/lib
38   /opt/local/lib64
39   /sw/lib
40   ENV LIBRARY_PATH   # PATH and LIB will also work
41   ENV LD_LIBRARY_PATH)
42 include (FindPackageHandleStandardArgs)
43
44
45 # handle the QUIETLY and REQUIRED arguments and set LIBDWARF_FOUND to TRUE
46 # if all listed variables are TRUE
47 FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibDwarf DEFAULT_MSG
48   LIBDWARF_LIBRARIES
49   LIBDWARF_INCLUDE_DIR)
50
51 #mark_as_advanced(LIBDW_INCLUDE_DIR DWARF_INCLUDE_DIR)
52 #mark_as_advanced(LIBDWARF_INCLUDE_DIRS LIBDWARF_LIBRARIES)