1# FindLibunwind
2# ---------
3#
4# Find the libunwind includes and library.
5#
6# Result Variables
7# ^^^^^^^^^^^^^^^^
8#
9# This module will set the following variables in your project:
10#
11# ``LIBUNWIND_INCLUDE_DIRS``
12#   where to find rpc.h, etc.
13# ``LIBUNWIND_LIBRARIES``
14#   the libraries to link against to use TIRPC.
15# ``LIBUNWIND_VERSION``
16#   the version of TIRPC found.
17# ``LIBUNWIND_FOUND``
18#   true if the TIRPC headers and libraries were found.
19#
20
21find_package(PkgConfig QUIET)
22pkg_check_modules(PC_LIBUNWIND libunwind)
23
24find_path(LIBUNWIND_INCLUDE_DIRS
25    NAMES libunwind.h
26    HINTS ${PC_LIBUNWIND_INCLUDE_DIRS}
27)
28
29find_library(LIBUNWIND_LIBRARIES
30    NAMES unwind
31    HINTS ${PC_LIBUNWIND_LIBRARY_DIRS}
32)
33
34set(LIBUNWIND_VERSION ${PC_LIBUNWIND_VERSION})
35
36include(FindPackageHandleStandardArgs)
37
38find_package_handle_standard_args(Libunwind
39    REQUIRED_VARS LIBUNWIND_LIBRARIES LIBUNWIND_INCLUDE_DIRS
40    VERSION_VAR LIBUNWIND_VERSION
41)
42
43mark_as_advanced(LIBUNWIND_INCLUDE_DIRS LIBUNWIND_LIBRARIES)
44