ClickHouse/cmake/find/icu.cmake

52 lines
1.8 KiB
CMake
Raw Normal View History

2020-01-05 20:43:14 +00:00
if (OS_LINUX)
option(ENABLE_ICU "Enable ICU" ${ENABLE_LIBRARIES})
else ()
option(ENABLE_ICU "Enable ICU" 0)
endif ()
2018-11-27 15:34:21 +00:00
if (NOT ENABLE_ICU)
if(USE_INTERNAL_ICU_LIBRARY)
message (${RECONFIGURE_MESSAGE_LEVEL} "Cannot use internal icu library with ENABLE_ICU=OFF")
endif()
message(STATUS "Build without ICU (support for collations and charset conversion functions will be disabled)")
return()
endif()
2019-12-15 03:00:53 +00:00
2021-11-21 10:58:26 +00:00
option (USE_INTERNAL_ICU_LIBRARY "Set to FALSE to use system ICU library instead of bundled" ON)
2019-12-15 03:00:53 +00:00
if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/icu/icu4c/LICENSE")
if (USE_INTERNAL_ICU_LIBRARY)
2021-10-17 23:29:04 +00:00
message (WARNING "submodule contrib/icu is missing. to fix try run: \n git submodule update --init")
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find internal ICU")
2019-12-15 03:00:53 +00:00
set (USE_INTERNAL_ICU_LIBRARY 0)
endif ()
set (MISSING_INTERNAL_ICU_LIBRARY 1)
endif ()
if(NOT USE_INTERNAL_ICU_LIBRARY)
2019-05-08 07:40:27 +00:00
if (APPLE)
set(ICU_ROOT "/usr/local/opt/icu4c" CACHE STRING "")
endif()
2018-12-11 13:47:53 +00:00
find_package(ICU COMPONENTS i18n uc data) # TODO: remove Modules/FindICU.cmake after cmake 3.7
2018-11-27 15:34:21 +00:00
#set (ICU_LIBRARIES ${ICU_I18N_LIBRARY} ${ICU_UC_LIBRARY} ${ICU_DATA_LIBRARY} CACHE STRING "")
2018-12-11 13:47:53 +00:00
if(ICU_FOUND)
2018-11-27 15:34:21 +00:00
set(USE_ICU 1)
else()
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system ICU")
2018-12-11 13:47:53 +00:00
endif()
endif()
2018-11-27 15:34:21 +00:00
2019-12-15 03:00:53 +00:00
if (ICU_LIBRARY AND ICU_INCLUDE_DIR)
set (USE_ICU 1)
elseif (NOT MISSING_INTERNAL_ICU_LIBRARY)
set (USE_INTERNAL_ICU_LIBRARY 1)
set (ICU_LIBRARIES icui18n icuuc icudata)
set (USE_ICU 1)
endif ()
2018-12-11 13:47:53 +00:00
if(USE_ICU)
message(STATUS "Using icu=${USE_ICU}: ${ICU_INCLUDE_DIR} : ${ICU_LIBRARIES}")
else()
message(STATUS "Build without ICU (support for collations and charset conversion functions will be disabled)")
endif()