2018-01-20 02:35:16 +00:00
|
|
|
# This file copied from contrib/poco/cmake/FindODBC.cmake to allow build without submodules
|
|
|
|
|
2018-08-05 08:54:57 +00:00
|
|
|
option (ENABLE_ODBC "Enable ODBC" ${OS_LINUX})
|
2019-04-24 21:33:04 +00:00
|
|
|
if(ENABLE_ODBC)
|
|
|
|
if (OS_LINUX)
|
|
|
|
option(USE_INTERNAL_ODBC_LIBRARY "Set to FALSE to use system odbc library instead of bundled" ${NOT_UNBUNDLED})
|
2018-08-02 08:18:15 +00:00
|
|
|
else ()
|
2019-04-24 21:33:04 +00:00
|
|
|
option(USE_INTERNAL_ODBC_LIBRARY "Set to FALSE to use system odbc library instead of bundled" OFF)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(USE_INTERNAL_ODBC_LIBRARY AND NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/unixodbc/README")
|
|
|
|
message(WARNING "submodule contrib/unixodbc is missing. to fix try run: \n git submodule update --init --recursive")
|
|
|
|
set(USE_INTERNAL_ODBC_LIBRARY 0)
|
|
|
|
set(MISSING_INTERNAL_ODBC_LIBRARY 1)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(ODBC_INCLUDE_DIRS ) # Include directories will be either used automatically by target_include_directories or set later.
|
|
|
|
if(USE_INTERNAL_ODBC_LIBRARY AND NOT MISSING_INTERNAL_ODBC_LIBRARY)
|
|
|
|
set(ODBC_LIBRARY unixodbc)
|
|
|
|
set(ODBC_LIBRARIES ${ODBC_LIBRARY})
|
|
|
|
set(ODBC_INCLUDE_DIRS "${ClickHouse_SOURCE_DIR}/contrib/unixodbc/include")
|
|
|
|
set(ODBC_FOUND 1)
|
|
|
|
else()
|
|
|
|
find_package(ODBC)
|
2018-08-02 08:18:15 +00:00
|
|
|
endif ()
|
|
|
|
|
2019-04-24 21:33:04 +00:00
|
|
|
if(ODBC_FOUND)
|
|
|
|
set(USE_ODBC 1)
|
|
|
|
set(ODBC_INCLUDE_DIRECTORIES ${ODBC_INCLUDE_DIRS}) # for old poco
|
|
|
|
set(ODBC_INCLUDE_DIR ${ODBC_INCLUDE_DIRS}) # for old poco
|
|
|
|
endif()
|
|
|
|
|
|
|
|
message(STATUS "Using odbc=${USE_ODBC}: ${ODBC_INCLUDE_DIRS} : ${ODBC_LIBRARIES}")
|
|
|
|
endif()
|