summaryrefslogtreecommitdiffstats
path: root/cmake/FindLibbrotlienc.cmake
blob: acf63343cbf104705cba5d836dbfce3e01a26852 (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 libbrotlienc
# Once done this will define
#  LIBBROTLIENC_FOUND        - System has libbrotlienc
#  LIBBROTLIENC_INCLUDE_DIRS - The libbrotlienc include directories
#  LIBBROTLIENC_LIBRARIES    - The libraries needed to use libbrotlienc

find_package(PkgConfig QUIET)
pkg_check_modules(PC_LIBBROTLIENC QUIET libbrotlienc)

find_path(LIBBROTLIENC_INCLUDE_DIR
  NAMES brotli/encode.h
  HINTS ${PC_LIBBROTLIENC_INCLUDE_DIRS}
)
find_library(LIBBROTLIENC_LIBRARY
  NAMES brotlienc
  HINTS ${PC_LIBBROTLIENC_LIBRARY_DIRS}
)

if(PC_LIBBROTLIENC_FOUND)
  set(LIBBROTLIENC_VERSION ${PC_LIBBROTLIENC_VERSION})
endif()

include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LIBBROTLIENC_FOUND
# to TRUE if all listed variables are TRUE and the requested version
# matches.
find_package_handle_standard_args(Libbrotlienc REQUIRED_VARS
                                  LIBBROTLIENC_LIBRARY LIBBROTLIENC_INCLUDE_DIR
                                  VERSION_VAR LIBBROTLIENC_VERSION)

if(LIBBROTLIENC_FOUND)
  set(LIBBROTLIENC_LIBRARIES     ${LIBBROTLIENC_LIBRARY})
  set(LIBBROTLIENC_INCLUDE_DIRS  ${LIBBROTLIENC_INCLUDE_DIR})
endif()

mark_as_advanced(LIBBROTLIENC_INCLUDE_DIR LIBBROTLIENC_LIBRARY)