Cdroid/cmake/modules/FindBrotli.cmake
2023-09-06 18:29:48 +08:00

54 lines
1.7 KiB
CMake
Executable File

find_package(PkgConfig)
pkg_check_modules(PC_BROTLIDEC libbrotlicommon)
find_path(BROTLIDEC_INCLUDE_DIRS
NAMES brotli/decode.h
HINTS ${PC_BROTLIDEC_INCLUDEDIR}
${PC_BROTLIDEC_INCLUDE_DIRS}
)
find_library(BROTLIDEC_LIBRARIES
NAMES brotlidec brotlidec-static
HINTS ${PC_BROTLIDEC_LIBDIR}
${PC_BROTLIDEC_LIBRARY_DIRS}
)
find_path(BROTLIENC_INCLUDE_DIRS
NAMES brotli/encode.h
HINTS ${PC_BROTLIDEC_INCLUDEDIR}
${PC_BROTLIDEC_INCLUDE_DIRS}
)
find_library(BROTLIENC_LIBRARIES
NAMES brotlienc brotlienc-static
HINTS ${PC_BROTLIDEC_LIBDIR}
${PC_BROTLIDEC_LIBRARY_DIRS}
)
find_library(BROTLICOMMON_LIBRARIES
NAMES brotlicommon brotlicommon-static
HINTS ${PC_BROTLIDEC_LIBDIR}
${PC_BROTLIDEC_LIBRARY_DIRS}
)
include(FindPackageHandleStandardArgs)
if(BROTLIDEC_INCLUDE_DIRS AND BROTLIDEC_LIBRARIES)
set(BROTLIDEC_FOUND TRUE)
set(BROTLIDEC_LIBRARIES ${BROTLIDEC_LIBRARIES} ${BROTLICOMMON_LIBRARIES})
set(BROTLIDEC_LIBRARY ${BROTLIDEC_LIBRARIES})
set(BROTLIDEC_INCLUDE_DIR ${BROTLIDEC_INCLUDE_DIRS})
set(BROTLIDEC_VERSION ${PC_BROTLIDEC_VERSION})
mark_as_advanced(BROTLIDEC_LIBRARIES BROTLIDEC_LIBRARY BROTLIDEC_INCLUDE_DIRS BROTLIDEC_INCLUDE_DIR BROTLIDEC_FOUND BROTLIDEC_VERSION)
endif()
if(BROTLIENC_INCLUDE_DIRS AND BROTLIDENC_LIBRARIES)
set(BROTLIENC_FOUND TRUE)
set(BROTLIENC_LIBRARY ${BROTLIENC_LIBRARIES})
set(BROTLIENC_INCLUDE_DIR ${BROTLIENC_INCLUDE_DIRS})
set(BROTLIENC_VERSION ${PC_BROTLIENC_VERSION})
mark_as_advanced(BROTLIENC_LIBRARIES BROTLIENC_LIBRARY BROTLIENC_INCLUDE_DIRS BROTLIENC_INCLUDE_DIR BROTLIENC_FOUND BROTLIENC_VERSION)
endif()
#FIND_PACKAGE_HANDLE_STANDARD_ARGS(Brotli REQUIRED_VARS BROTLI_INCLUDE_DIRS BROTLI_LIBRARIES
# FOUND_VAR BROTLI_FOUND VERSION_VAR BROTLI_VERSION)