Skip to content

Commit

Permalink
Fix build without installd unixodbc (ClickHouse#708)
Browse files Browse the repository at this point in the history
* Fix build without installd unixodbc

* clean

* no openssl error

* fix

* fix
  • Loading branch information
proller authored and alexey-milovidov committed Apr 19, 2017
1 parent 0ba7243 commit ab5e6c4
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 19 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,13 @@ message (STATUS "Building for: ${CMAKE_SYSTEM} ${CMAKE_SYSTEM_PROCESSOR} ${CMAKE
include(GNUInstallDirs)

include (cmake/find_openssl.cmake)
if (NOT OPENSSL_FOUND)
message (FATAL_ERROR "Need openssl for build. debian tip: sudo apt install libssl-dev")
endif ()

include (cmake/find_icu4c.cmake)
include (cmake/find_boost.cmake)
# zlib before poco
# openssl, zlib before poco
include (cmake/find_zlib.cmake)
include (cmake/find_zstd.cmake)
include (cmake/find_poco.cmake)
Expand Down
12 changes: 9 additions & 3 deletions cmake/find_openssl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@ if (NOT OPENSSL_FOUND)
set (OPENSSL_PATHS "/usr/local/opt/openssl/lib")
find_library (OPENSSL_SSL_LIBRARY ssl PATHS ${OPENSSL_PATHS})
find_library (OPENSSL_CRYPTO_LIBRARY crypto PATHS ${OPENSSL_PATHS})
set (OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY})
if (OPENSSL_SSL_LIBRARY AND OPENSSL_CRYPTO_LIBRARY)
set (OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY})
set (OPENSSL_FOUND 1)
endif ()
endif ()

message (STATUS "Using openssl: ${OPENSSL_INCLUDE_DIR} : ${OPENSSL_LIBRARIES}")
include_directories (${OPENSSL_INCLUDE_DIR})
if (OPENSSL_FOUND)
include_directories (${OPENSSL_INCLUDE_DIR})
endif ()

message (STATUS "Using openssl=${OPENSSL_FOUND}: ${OPENSSL_INCLUDE_DIR} : ${OPENSSL_LIBRARIES}")
46 changes: 32 additions & 14 deletions cmake/find_poco.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,53 @@ endif ()
if (Poco_INCLUDE_DIRS AND Poco_Foundation_LIBRARY)
include_directories (${Poco_INCLUDE_DIRS})
else ()

set (USE_INTERNAL_POCO_LIBRARY 1)
set (Poco_MongoDB_FOUND 1)
set (Poco_DataODBC_FOUND 1)
set (Poco_NetSSL_FOUND 1)
set (Poco_INCLUDE_DIRS

include (${ClickHouse_SOURCE_DIR}/contrib/libpoco/cmake/FindODBC.cmake)

list (APPEND Poco_INCLUDE_DIRS
"${ClickHouse_SOURCE_DIR}/contrib/libpoco/Foundation/include/"
"${ClickHouse_SOURCE_DIR}/contrib/libpoco/Util/include/"
"${ClickHouse_SOURCE_DIR}/contrib/libpoco/Net/include/"
"${ClickHouse_SOURCE_DIR}/contrib/libpoco/NetSSL_OpenSSL/include/"
"${ClickHouse_SOURCE_DIR}/contrib/libpoco/Data/include/"
"${ClickHouse_SOURCE_DIR}/contrib/libpoco/Data/ODBC/include/"
"${ClickHouse_SOURCE_DIR}/contrib/libpoco/Crypto/include/"
"${ClickHouse_SOURCE_DIR}/contrib/libpoco/XML/include/"
"${ClickHouse_SOURCE_DIR}/contrib/libpoco/MongoDB/include/"
)

if (POCO_ENABLE_MONGODB)
set (Poco_MongoDB_FOUND 1)
set (Poco_MongoDB_LIBRARY PocoMongoDB)
list (APPEND Poco_INCLUDE_DIRS "${ClickHouse_SOURCE_DIR}/contrib/libpoco/MongoDB/include/")
endif ()

if (ODBC_FOUND)
set (Poco_DataODBC_FOUND 1)
set (Poco_DataODBC_LIBRARY PocoDataODBC)
list (APPEND Poco_INCLUDE_DIRS "${ClickHouse_SOURCE_DIR}/contrib/libpoco/Data/ODBC/include/")
endif ()

if (OPENSSL_FOUND)
set (Poco_NetSSL_FOUND 1)
set (Poco_NetSSL_LIBRARY PocoNetSSL)
set (Poco_Crypto_LIBRARY PocoCrypto)
list (APPEND Poco_INCLUDE_DIRS
"${ClickHouse_SOURCE_DIR}/contrib/libpoco/NetSSL_OpenSSL/include/"
"${ClickHouse_SOURCE_DIR}/contrib/libpoco/Crypto/include/"
)
endif ()

if (USE_STATIC_LIBRARIES AND USE_INTERNAL_ZLIB_LIBRARY)
set (Poco_INCLUDE_DIRS ${Poco_INCLUDE_DIRS} "${ClickHouse_SOURCE_DIR}/contrib/libzlib-ng/" "${ClickHouse_BINARY_DIR}/contrib/libzlib-ng/")
list (APPEND Poco_INCLUDE_DIRS
"${ClickHouse_SOURCE_DIR}/contrib/libzlib-ng/"
"${ClickHouse_BINARY_DIR}/contrib/libzlib-ng/"
)
endif ()

set (Poco_Foundation_LIBRARY PocoFoundation)
set (Poco_Util_LIBRARY PocoUtil)
set (Poco_Net_LIBRARY PocoNet)
set (Poco_NetSSL_LIBRARY PocoNetSSL)
set (Poco_XML_LIBRARY PocoXML)
set (Poco_Data_LIBRARY PocoData)
set (Poco_Crypto_LIBRARY PocoCrypto)
set (Poco_DataODBC_LIBRARY PocoDataODBC)
set (Poco_MongoDB_LIBRARY PocoMongoDB)
set (Poco_XML_LIBRARY PocoXML)
include_directories (BEFORE ${Poco_INCLUDE_DIRS})
endif ()

Expand Down
1 change: 0 additions & 1 deletion dbms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/contrib/libcpuid/include)
include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/contrib/libfarmhash)
include_directories (BEFORE ${ClickHouse_SOURCE_DIR}/contrib/libmetrohash/src)
include_directories (${ClickHouse_SOURCE_DIR}/libs/libdaemon/include)
include_directories (${ODBC_INCLUDE_DIRECTORIES})
include_directories (${ClickHouse_BINARY_DIR}/dbms/src)

if (NOT NO_WERROR)
Expand Down

0 comments on commit ab5e6c4

Please sign in to comment.