cmake: add support for brotli

Currently CMake cannot detect Brotli support. This adds detection of the
libraries and associated header files. It also adds this to the
generated config.

Closes #2392
This commit is contained in:
Don 2018-03-16 12:49:13 -07:00 committed by Daniel Stenberg
parent b7b2809a21
commit d22e5e02a2
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 35 additions and 0 deletions

20
CMake/FindBrotli.cmake Normal file
View file

@ -0,0 +1,20 @@
include(FindPackageHandleStandardArgs)
find_path(BROTLI_INCLUDE_DIR "brotli/decode.h")
find_library(BROTLICOMMON_LIBRARY NAMES brotlicommon)
find_library(BROTLIDEC_LIBRARY NAMES brotlidec)
find_package_handle_standard_args(BROTLI
FOUND_VAR
BROTLI_FOUND
REQUIRED_VARS
BROTLIDEC_LIBRARY
BROTLICOMMON_LIBRARY
BROTLI_INCLUDE_DIR
FAIL_MESSAGE
"Could NOT find BROTLI"
)
set(BROTLI_INCLUDE_DIRS ${BROTLI_INCLUDE_DIR})
set(BROTLI_LIBRARIES ${BROTLICOMMON_LIBRARY} ${BROTLIDEC_LIBRARY})