ClickHouse/cmake/find_brotli.cmake

26 lines
1.0 KiB
CMake
Raw Normal View History

2019-02-02 13:33:50 +00:00
option (USE_INTERNAL_BROTLI_LIBRARY "Set to FALSE to use system libbrotli library instead of bundled" ${NOT_UNBUNDLED})
if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/brotli/c/include/brotli/decode.h")
if (USE_INTERNAL_BROTLI_LIBRARY)
message (WARNING "submodule contrib/brotli is missing. to fix try run: \n git submodule update --init --recursive")
set (USE_INTERNAL_BROTLI_LIBRARY 0)
endif ()
set (MISSING_INTERNAL_BROTLI_LIBRARY 1)
endif ()
if (NOT USE_INTERNAL_BROTLI_LIBRARY)
2019-02-02 14:17:51 +00:00
find_library (BROTLI_LIBRARY brotli)
2019-02-02 13:33:50 +00:00
find_path (BROTLI_INCLUDE_DIR NAMES decode.h encode.h port.h types.h PATHS ${BROTLI_INCLUDE_PATHS})
endif ()
if (BROTLI_LIBRARY AND BROTLI_INCLUDE_DIR)
2019-02-03 14:14:30 +00:00
set (USE_BROTLI 1)
2019-02-02 13:33:50 +00:00
elseif (NOT MISSING_INTERNAL_BROTLI_LIBRARY)
2019-02-02 14:17:51 +00:00
set (BROTLI_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/brotli/c/include)
2019-02-02 13:33:50 +00:00
set (USE_INTERNAL_BROTLI_LIBRARY 1)
2019-02-02 14:17:51 +00:00
set (BROTLI_LIBRARY brotli)
set (USE_BROTLI 1)
2019-02-02 13:33:50 +00:00
endif ()
2019-02-03 14:14:30 +00:00
message (STATUS "Using brotli=${USE_BROTLI}: ${BROTLI_INCLUDE_DIR} : ${BROTLI_LIBRARY}")