Fix linking iconv under macos and freebsd

Partially Revert "Removed usage of glib [#CLICKHOUSE-2]."
This reverts commit e4ff740ef1.
This commit is contained in:
proller 2017-01-31 04:14:56 +03:00 committed by proller
parent aaa8d56759
commit 9cea606881
2 changed files with 12 additions and 6 deletions

10
cmake/find_iconv.cmake Normal file
View File

@ -0,0 +1,10 @@
if (APPLE OR CMAKE_SYSTEM MATCHES "FreeBSD")
set (ICONV_INCLUDE_PATHS "/usr/local/opt/libiconv/lib")
find_path (ICONV_INCLUDE_DIR iconv.h PATHS ${ICONV_INCLUDE_PATHS})
set (ICONV_PATHS "/usr/local/opt/libiconv/lib")
find_library (ICONV_LIBRARY iconv PATHS ${ICONV_PATHS})
message (STATUS "Using iconv: ${ICONV_INCLUDE_DIR} : ${ICONV_LIBRARY}")
include_directories(${ICONV_INCLUDE_DIR})
else ()
set (ICONV_LIBRARY "")
endif ()

View File

@ -114,11 +114,6 @@ if (NOT AARCH64)
set (LINK_LIBRARIES_ONLY_ON_X86_64 cpuid)
endif()
set (APPLE_ICONV_LIB "")
if (APPLE)
set(APPLE_ICONV_LIB iconv)
endif()
if (CMAKE_SYSTEM MATCHES "FreeBSD")
set(PLATFORM_LIBS "execinfo")
else()
@ -132,6 +127,7 @@ else()
find_library (Z_LIB z HINTS ${Z_HINTS})
endif ()
include (${CMAKE_SOURCE_DIR}/cmake/find_iconv.cmake)
find_package (Threads)
target_link_libraries(dbms
@ -151,7 +147,7 @@ target_link_libraries(dbms
${Poco_DataODBC_LIBRARY}
${Poco_MongoDB_LIBRARY}
${Poco_Foundation_LIBRARY}
${APPLE_ICONV_LIB}
${ICONV_LIBRARY}
${PLATFORM_LIBS}
${CMAKE_DL_LIBS}
${LTDL_LIB}