mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
cmake: Fix odbc in unbudled
Signed-off-by: Konstantin Podshumok <kpp.live+signed@gmail.com>
This commit is contained in:
parent
8479da3033
commit
5097793872
@ -419,6 +419,7 @@ include (cmake/find/parquet.cmake)
|
||||
include (cmake/find/simdjson.cmake)
|
||||
include (cmake/find/rapidjson.cmake)
|
||||
include (cmake/find/fastops.cmake)
|
||||
include (cmake/find/odbc.cmake)
|
||||
|
||||
if(NOT USE_INTERNAL_PARQUET_LIBRARY)
|
||||
set (ENABLE_ORC OFF CACHE INTERNAL "")
|
||||
|
53
cmake/find/odbc.cmake
Normal file
53
cmake/find/odbc.cmake
Normal file
@ -0,0 +1,53 @@
|
||||
option (ENABLE_ODBC "Enable ODBC library" ${ENABLE_LIBRARIES})
|
||||
|
||||
if (NOT OS_LINUX)
|
||||
if (ENABLE_ODBC)
|
||||
message(STATUS "ODBC is only supported on Linux")
|
||||
endif()
|
||||
set (ENABLE_ODBC OFF CACHE INTERNAL "")
|
||||
endif ()
|
||||
|
||||
if (NOT ENABLE_ODBC)
|
||||
if (USE_INTERNAL_ODBC_LIBRARY)
|
||||
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use internal ODBC with ENABLE_ODBC=OFF")
|
||||
endif()
|
||||
|
||||
add_library (unixodbc INTERFACE)
|
||||
target_compile_definitions (unixodbc INTERFACE USE_ODBC=0)
|
||||
|
||||
message (STATUS "Not using unixodbc")
|
||||
return()
|
||||
endif()
|
||||
|
||||
option (USE_INTERNAL_ODBC_LIBRARY "Use internal ODBC library" ${NOT_UNBUNDLED})
|
||||
|
||||
if (NOT USE_INTERNAL_ODBC_LIBRARY)
|
||||
find_library (LIBRARY_ODBC NAMES unixodbc odbc)
|
||||
find_path (INCLUDE_ODBC sql.h)
|
||||
|
||||
if(LIBRARY_ODBC AND INCLUDE_ODBC)
|
||||
add_library (unixodbc UNKNOWN IMPORTED)
|
||||
set_target_properties (unixodbc PROPERTIES IMPORTED_LOCATION ${LIBRARY_ODBC})
|
||||
set_target_properties (unixodbc PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${INCLUDE_ODBC})
|
||||
set_target_properties (unixodbc PROPERTIES INTERFACE_COMPILE_DEFINITIONS USE_ODBC=1)
|
||||
|
||||
if (USE_STATIC_LIBRARIES)
|
||||
find_library(LTDL_LIBRARY ltdl)
|
||||
if (LTDL_LIBRARY)
|
||||
target_link_libraries(unixodbc INTERFACE ${LTDL_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(EXTERNAL_ODBC_LIBRARY_FOUND 1)
|
||||
message (STATUS "Found odbc: ${LIBRARY_ODBC}")
|
||||
else()
|
||||
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system ODBC library")
|
||||
set(EXTERNAL_ODBC_LIBRARY_FOUND 0)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT EXTERNAL_ODBC_LIBRARY_FOUND)
|
||||
set (USE_INTERNAL_ODBC_LIBRARY 1)
|
||||
endif ()
|
||||
|
||||
message (STATUS "Using unixodbc")
|
@ -1,4 +1,8 @@
|
||||
if (ENABLE_ODBC)
|
||||
if (NOT TARGET unixodbc)
|
||||
message(FATAL_ERROR "Configuration error: unixodbc is not a target")
|
||||
endif()
|
||||
|
||||
if (USE_INTERNAL_POCO_LIBRARY)
|
||||
set (SRCS
|
||||
${LIBRARY_DIR}/Data/ODBC/src/Binder.cpp
|
||||
|
@ -1,44 +1,7 @@
|
||||
option (ENABLE_ODBC "Enable ODBC library" ${ENABLE_LIBRARIES})
|
||||
|
||||
if (NOT OS_LINUX)
|
||||
if (ENABLE_ODBC)
|
||||
message(STATUS "ODBC is only supported on Linux")
|
||||
endif()
|
||||
set (ENABLE_ODBC OFF CACHE INTERNAL "")
|
||||
endif ()
|
||||
|
||||
if (NOT ENABLE_ODBC)
|
||||
if (USE_INTERNAL_ODBC_LIBRARY)
|
||||
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't use internal ODBC with ENABLE_ODBC=OFF")
|
||||
endif()
|
||||
|
||||
add_library (unixodbc INTERFACE)
|
||||
target_compile_definitions (unixodbc INTERFACE USE_ODBC=0)
|
||||
|
||||
message (STATUS "Not using unixodbc")
|
||||
if (NOT USE_INTERNAL_ODBC_LIBRARY)
|
||||
return()
|
||||
endif()
|
||||
|
||||
option (USE_INTERNAL_ODBC_LIBRARY "Use internal ODBC library" ${NOT_UNBUNDLED})
|
||||
|
||||
if (NOT USE_INTERNAL_ODBC_LIBRARY)
|
||||
find_library (LIBRARY_ODBC unixodbc)
|
||||
find_path (INCLUDE_ODBC sql.h)
|
||||
|
||||
if(LIBRARY_ODBC AND INCLUDE_ODBC)
|
||||
add_library (unixodbc UNKNOWN IMPORTED)
|
||||
set_target_properties (unixodbc PROPERTIES IMPORTED_LOCATION ${LIBRARY_ODBC})
|
||||
set_target_properties (unixodbc PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${INCLUDE_ODBC})
|
||||
set(EXTERNAL_ODBC_LIBRARY_FOUND 1)
|
||||
else()
|
||||
message (${RECONFIGURE_MESSAGE_LEVEL} "Can't find system ODBC library")
|
||||
set(EXTERNAL_ODBC_LIBRARY_FOUND 0)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT EXTERNAL_ODBC_LIBRARY_FOUND)
|
||||
set (USE_INTERNAL_ODBC_LIBRARY 1)
|
||||
|
||||
set (LIBRARY_DIR ${ClickHouse_SOURCE_DIR}/contrib/unixodbc)
|
||||
|
||||
# ltdl
|
||||
@ -329,8 +292,4 @@ if (NOT EXTERNAL_ODBC_LIBRARY_FOUND)
|
||||
-Wno-reserved-id-macro
|
||||
-O2
|
||||
)
|
||||
endif ()
|
||||
|
||||
target_compile_definitions (unixodbc INTERFACE USE_ODBC=1)
|
||||
|
||||
message (STATUS "Using unixodbc")
|
||||
|
Loading…
Reference in New Issue
Block a user