summaryrefslogtreecommitdiffstats
path: root/cmake/FindLibbrotlidec.cmake
blob: 59066c6401d974df47bd5f10276dba0a49fc42a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# - Try to find libbrotlidec
# Once done this will define
#  LIBBROTLIDEC_FOUND        - System has libbrotlidec
#  LIBBROTLIDEC_INCLUDE_DIRS - The libbrotlidec include directories
#  LIBBROTLIDEC_LIBRARIES    - The libraries needed to use libbrotlidec

find_package(PkgConfig QUIET)
pkg_check_modules(PC_LIBBROTLIDEC QUIET libbrotlidec)

find_path(LIBBROTLIDEC_INCLUDE_DIR
  NAMES brotli/decode.h
  HINTS ${PC_LIBBROTLIDEC_INCLUDE_DIRS}
)
find_library(LIBBROTLIDEC_LIBRARY
  NAMES brotlidec
  HINTS ${PC_LIBBROTLIDEC_LIBRARY_DIRS}
)

if(PC_LIBBROTLIDEC_FOUND)
  set(LIBBROTLIDEC_VERSION ${PC_LIBBROTLIDEC_VERSION})
endif()

include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LIBBROTLIDEC_FOUND
# to TRUE if all listed variables are TRUE and the requested version
# matches.
find_package_handle_standard_args(Libbrotlidec REQUIRED_VARS
                                  LIBBROTLIDEC_LIBRARY LIBBROTLIDEC_INCLUDE_DIR
                                  VERSION_VAR LIBBROTLIDEC_VERSION)

if(LIBBROTLIDEC_FOUND)
  set(LIBBROTLIDEC_LIBRARIES     ${LIBBROTLIDEC_LIBRARY})
  set(LIBBROTLIDEC_INCLUDE_DIRS  ${LIBBROTLIDEC_INCLUDE_DIR})
endif()

mark_as_advanced(LIBBROTLIDEC_INCLUDE_DIR LIBBROTLIDEC_LIBRARY)