xref: /aosp_15_r20/external/bcc/cmake/FindLibDebuginfod.cmake (revision 387f9dfdfa2baef462e92476d413c7bc2470293e)
1*387f9dfdSAndroid Build Coastguard Worker# - Try to find libdebuginfod
2*387f9dfdSAndroid Build Coastguard Worker# Once done this will define
3*387f9dfdSAndroid Build Coastguard Worker#
4*387f9dfdSAndroid Build Coastguard Worker#  LIBDEBUGINFOD_FOUND - system has libdebuginfod
5*387f9dfdSAndroid Build Coastguard Worker#  LIBDEBUGINFOD_INCLUDE_DIRS - the libdebuginfod include directory
6*387f9dfdSAndroid Build Coastguard Worker#  LIBDEBUGINFOD_LIBRARIES - Link these to use libdebuginfod
7*387f9dfdSAndroid Build Coastguard Worker#  LIBDEBUGINFOD_DEFINITIONS - Compiler switches required for using libdebuginfod
8*387f9dfdSAndroid Build Coastguard Worker
9*387f9dfdSAndroid Build Coastguard Worker
10*387f9dfdSAndroid Build Coastguard Workerif (LIBDEBUGINFOD_LIBRARIES AND LIBDEBUGINFOD_INCLUDE_DIRS)
11*387f9dfdSAndroid Build Coastguard Worker    set (LibDebuginfod_FIND_QUIETLY TRUE)
12*387f9dfdSAndroid Build Coastguard Workerendif (LIBDEBUGINFOD_LIBRARIES AND LIBDEBUGINFOD_INCLUDE_DIRS)
13*387f9dfdSAndroid Build Coastguard Worker
14*387f9dfdSAndroid Build Coastguard Workerfind_path (LIBDEBUGINFOD_INCLUDE_DIRS
15*387f9dfdSAndroid Build Coastguard Worker  NAMES
16*387f9dfdSAndroid Build Coastguard Worker    elfutils/debuginfod.h
17*387f9dfdSAndroid Build Coastguard Worker  PATHS
18*387f9dfdSAndroid Build Coastguard Worker    /usr/include
19*387f9dfdSAndroid Build Coastguard Worker    /usr/include/libelf
20*387f9dfdSAndroid Build Coastguard Worker    /usr/include/elfutils
21*387f9dfdSAndroid Build Coastguard Worker    /usr/local/include
22*387f9dfdSAndroid Build Coastguard Worker    /usr/local/include/libelf
23*387f9dfdSAndroid Build Coastguard Worker    /usr/local/include/elfutils
24*387f9dfdSAndroid Build Coastguard Worker    /opt/local/include
25*387f9dfdSAndroid Build Coastguard Worker    /opt/local/include/libelf
26*387f9dfdSAndroid Build Coastguard Worker    /opt/local/include/elfutils
27*387f9dfdSAndroid Build Coastguard Worker    /sw/include
28*387f9dfdSAndroid Build Coastguard Worker    /sw/include/libelf
29*387f9dfdSAndroid Build Coastguard Worker    /sw/include/elfutils
30*387f9dfdSAndroid Build Coastguard Worker    ENV CPATH)
31*387f9dfdSAndroid Build Coastguard Worker
32*387f9dfdSAndroid Build Coastguard Workerfind_library (LIBDEBUGINFOD_LIBRARIES
33*387f9dfdSAndroid Build Coastguard Worker  NAMES
34*387f9dfdSAndroid Build Coastguard Worker    debuginfod
35*387f9dfdSAndroid Build Coastguard Worker  PATHS
36*387f9dfdSAndroid Build Coastguard Worker    /usr/lib
37*387f9dfdSAndroid Build Coastguard Worker    /usr/local/lib
38*387f9dfdSAndroid Build Coastguard Worker    /opt/local/lib
39*387f9dfdSAndroid Build Coastguard Worker    /sw/lib
40*387f9dfdSAndroid Build Coastguard Worker    ENV LIBRARY_PATH
41*387f9dfdSAndroid Build Coastguard Worker    ENV LD_LIBRARY_PATH)
42*387f9dfdSAndroid Build Coastguard Worker
43*387f9dfdSAndroid Build Coastguard Workerinclude (FindPackageHandleStandardArgs)
44*387f9dfdSAndroid Build Coastguard Worker
45*387f9dfdSAndroid Build Coastguard Worker
46*387f9dfdSAndroid Build Coastguard Worker# handle the QUIETLY and REQUIRED arguments and set LIBDEBUGINFOD_FOUND to TRUE if all listed variables are TRUE
47*387f9dfdSAndroid Build Coastguard WorkerFIND_PACKAGE_HANDLE_STANDARD_ARGS(LibDebuginfod DEFAULT_MSG
48*387f9dfdSAndroid Build Coastguard Worker  LIBDEBUGINFOD_LIBRARIES
49*387f9dfdSAndroid Build Coastguard Worker  LIBDEBUGINFOD_INCLUDE_DIRS)
50*387f9dfdSAndroid Build Coastguard Worker
51*387f9dfdSAndroid Build Coastguard Workerif (LIBDEBUGINFOD_FOUND AND ENABLE_LIBDEBUGINFOD)
52*387f9dfdSAndroid Build Coastguard Worker  add_definitions(-DHAVE_LIBDEBUGINFOD)
53*387f9dfdSAndroid Build Coastguard Workerendif (LIBDEBUGINFOD_FOUND AND ENABLE_LIBDEBUGINFOD)
54*387f9dfdSAndroid Build Coastguard Worker
55*387f9dfdSAndroid Build Coastguard Workermark_as_advanced(LIBDEBUGINFOD_INCLUDE_DIRS LIBDEBUGINFOD_LIBRARIES)
56