2019-03-04 17:47:31 +00:00
set ( CLICKHOUSE_ODBC_BRIDGE_SOURCES
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / C o l u m n I n f o H a n d l e r . c p p
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / g e t I d e n t i f i e r Q u o t e . c p p
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / H a n d l e r F a c t o r y . c p p
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / I d e n t i f i e r Q u o t e H a n d l e r . c p p
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / M a i n H a n d l e r . c p p
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / O D B C B l o c k I n p u t S t r e a m . c p p
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / O D B C B r i d g e . c p p
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / P i n g H a n d l e r . c p p
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / v a l i d a t e O D B C C o n n e c t i o n S t r i n g . c p p
)
2019-07-03 16:53:20 +00:00
set ( CLICKHOUSE_ODBC_BRIDGE_LINK PRIVATE dbms clickhouse_parsers PUBLIC daemon )
2019-03-04 17:47:31 +00:00
set ( CLICKHOUSE_ODBC_BRIDGE_INCLUDE PUBLIC ${ ClickHouse_SOURCE_DIR } /libs/libdaemon/include )
2018-08-07 17:57:44 +00:00
2018-08-19 17:09:54 +00:00
if ( USE_POCO_SQLODBC )
2019-03-04 17:47:31 +00:00
set ( CLICKHOUSE_ODBC_BRIDGE_LINK ${ CLICKHOUSE_ODBC_BRIDGE_LINK } PRIVATE ${ Poco_SQLODBC_LIBRARY } )
2020-01-17 18:55:45 +00:00
# Wouldnt work anyway because of the way list variable got expanded in `target_include_directories`
# set(CLICKHOUSE_ODBC_BRIDGE_INCLUDE ${CLICKHOUSE_ODBC_BRIDGE_INCLUDE} SYSTEM PRIVATE ${ODBC_INCLUDE_DIRS} ${Poco_SQLODBC_INCLUDE_DIR})
2018-09-14 19:48:51 +00:00
endif ( )
if ( Poco_SQL_FOUND )
2019-03-04 17:47:31 +00:00
set ( CLICKHOUSE_ODBC_BRIDGE_LINK ${ CLICKHOUSE_ODBC_BRIDGE_LINK } PRIVATE ${ Poco_SQL_LIBRARY } )
2020-01-17 18:55:45 +00:00
# Wouldnt work anyway because of the way list variable got expanded in `target_include_directories`
# set(CLICKHOUSE_ODBC_BRIDGE_INCLUDE ${CLICKHOUSE_ODBC_BRIDGE_INCLUDE} SYSTEM PRIVATE ${Poco_SQL_INCLUDE_DIR})
2018-08-19 17:09:54 +00:00
endif ( )
if ( USE_POCO_DATAODBC )
2019-03-04 17:47:31 +00:00
set ( CLICKHOUSE_ODBC_BRIDGE_LINK ${ CLICKHOUSE_ODBC_BRIDGE_LINK } PRIVATE ${ Poco_DataODBC_LIBRARY } )
2020-01-17 18:55:45 +00:00
# Wouldnt work anyway because of the way list variable got expanded in `target_include_directories`
# set(CLICKHOUSE_ODBC_BRIDGE_INCLUDE ${CLICKHOUSE_ODBC_BRIDGE_INCLUDE} SYSTEM PRIVATE ${ODBC_INCLUDE_DIRS} ${Poco_DataODBC_INCLUDE_DIR})
2018-08-19 17:09:54 +00:00
endif ( )
2018-09-14 19:48:51 +00:00
if ( Poco_Data_FOUND )
2019-03-04 17:47:31 +00:00
set ( CLICKHOUSE_ODBC_BRIDGE_LINK ${ CLICKHOUSE_ODBC_BRIDGE_LINK } PRIVATE ${ Poco_Data_LIBRARY } )
2020-01-17 18:55:45 +00:00
# Wouldnt work anyway because of the way list variable got expanded in `target_include_directories`
# set(CLICKHOUSE_ODBC_BRIDGE_INCLUDE ${CLICKHOUSE_ODBC_BRIDGE_INCLUDE} SYSTEM PRIVATE ${Poco_Data_INCLUDE_DIR})
2018-09-14 19:48:51 +00:00
endif ( )
2018-08-19 17:09:54 +00:00
2019-03-04 17:47:31 +00:00
clickhouse_program_add_library ( odbc-bridge )
2018-08-19 17:09:54 +00:00
2019-09-20 17:34:59 +00:00
if ( OS_LINUX )
# clickhouse-odbc-bridge is always a separate binary.
# Reason: it must not export symbols from SSL, mariadb-client, etc. to not break ABI compatibility with ODBC drivers.
set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-export-dynamic" )
endif ( )
2018-12-14 19:28:37 +00:00
2019-04-25 23:21:59 +00:00
add_executable ( clickhouse-odbc-bridge odbc-bridge.cpp )
set_target_properties ( clickhouse-odbc-bridge PROPERTIES RUNTIME_OUTPUT_DIRECTORY .. )
2019-03-04 17:47:31 +00:00
clickhouse_program_link_split_binary ( odbc-bridge )
2019-09-17 09:49:27 +00:00
if ( USE_GDB_ADD_INDEX )
add_custom_command ( TARGET clickhouse-odbc-bridge POST_BUILD COMMAND ${ GDB_ADD_INDEX_EXE } ../clickhouse-odbc-bridge COMMENT "Adding .gdb-index to clickhouse-odbc-bridge" VERBATIM )
endif ( )
2019-04-25 23:21:59 +00:00
install ( TARGETS clickhouse-odbc-bridge RUNTIME DESTINATION ${ CMAKE_INSTALL_BINDIR } COMPONENT clickhouse )
2019-03-04 17:47:31 +00:00
2019-04-25 23:21:59 +00:00
if ( ENABLE_TESTS )
add_subdirectory ( tests )
endif ( )