Starting to change the library used for dwarf parsin.
[dyninst.git] / cmake / Modules / FindLibElf.cmake
1 # - Try to find libelf
2 # Once done this will define
3 #
4 #  LIBELF_FOUND - system has libelf
5 #  LIBELF_INCLUDE_DIRS - the libelf include directory
6 #  LIBELF_LIBRARIES - Link these to use libelf
7 #  LIBELF_DEFINITIONS - Compiler switches required for using libelf
8 #
9 #  Copyright (c) 2008 Bernhard Walle <bernhard.walle@gmx.de>
10 #
11 #  Redistribution and use is allowed according to the terms of the New
12 #  BSD license.
13 #  For details see the accompanying COPYING-CMAKE-SCRIPTS file.
14 #
15
16 if (LIBELF_LIBRARIES AND LIBELF_INCLUDE_DIRS)
17   set (LibElf_FIND_QUIETLY TRUE)
18 endif (LIBELF_LIBRARIES AND LIBELF_INCLUDE_DIRS)
19
20 find_path (LIBELF_INCLUDE_DIR
21     NAMES
22       libelf.h
23     HINTS
24       ${LIBELF_INCLUDE_DIRS}
25     PATHS
26       /usr/include
27       /usr/include/libelf
28       /usr/local/include
29       /usr/local/include/libelfls 
30       /opt/local/include
31       /opt/local/include/libelf
32       /sw/include
33       /sw/include/libelf
34       ENV CPATH)
35
36 find_library (LIBELF_LIBRARIES
37     NAMES
38       libelf.so.1
39     HINTS
40       ${LIBELF_LIBRARIES}
41     PATHS
42       /usr/lib
43       /usr/lib64
44       /usr/local/lib
45       /usr/local/lib64
46       /opt/local/lib
47       /opt/local/lib64
48       /sw/lib
49       ENV LIBRARY_PATH
50       ENV LD_LIBRARY_PATH)
51
52 include (FindPackageHandleStandardArgs)
53
54
55 # handle the QUIETLY and REQUIRED arguments and set LIBELF_FOUND to TRUE if all listed variables are TRUE
56 FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibElf DEFAULT_MSG
57     LIBELF_LIBRARIES
58     LIBELF_INCLUDE_DIR)
59
60
61 # mark_as_advanced(LIBELF_INCLUDE_DIRS LIBELF_LIBRARIES)