Skip to content

Commit

Permalink
Add more search paths to find_mysqlclient.cmake, rename find_libmysql…
Browse files Browse the repository at this point in the history
…client.cmake -> find_mysqlclient.cmake
  • Loading branch information
proller committed Jan 12, 2017
1 parent eb2c819 commit 4bfa697
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 12 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
project (ClickHouse)
cmake_minimum_required (VERSION 2.6)

message(STATUS "Building for: ${CMAKE_SYSTEM} ${CMAKE_SYSTEM_PROCESSOR} ${CMAKE_LIBRARY_ARCHITECTURE}")

if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# Require at least gcc 5
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5 AND NOT CMAKE_VERSION VERSION_LESS 2.8.9)
Expand Down Expand Up @@ -189,7 +191,7 @@ include (cmake/find_openssl.cmake)
include (cmake/find_icu4c.cmake)
include (cmake/find_boost.cmake)
include (cmake/find_libtool.cmake)
include (cmake/find_libmysqlclient.cmake)
include (cmake/find_mysqlclient.cmake)
include (cmake/find_rt.cmake)

# Directory for Yandex specific files
Expand Down
9 changes: 0 additions & 9 deletions cmake/find_libmysqlclient.cmake

This file was deleted.

31 changes: 31 additions & 0 deletions cmake/find_mysqlclient.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
set (MYSQL_LIB_PATHS
"/usr/local/opt/mysql/lib"
"/usr/local/lib/mysql/"
"/usr/local/lib/mysql"
"/usr/local/lib64/mysql"
"/usr/mysql/lib/mysql"
"/usr/mysql/lib64/mysql"
"/usr/lib/mysql"
"/usr/lib64/mysql"
"/lib/mysql"
"/lib64/mysql"
)

set (MYSQL_INCLUDE_PATHS
"/usr/local/opt/mysql/include"
"/usr/mysql/include/mysql"
"/usr/local/include/mysql"
"/usr/include/mysql"
)

find_path (MYSQL_INCLUDE_DIR NAMES mysql.h PATH_SUFFIXES mysql PATHS ${MYSQL_INCLUDE_PATHS})

if (USE_STATIC_LIBRARIES)
find_library (STATIC_MYSQLCLIENT_LIB libmysqlclient.a PATHS ${MYSQL_LIB_PATHS})
else ()
find_library (MYSQLCLIENT_LIB mysqlclient PATHS ${MYSQL_LIB_PATHS})
endif ()

include_directories (${MYSQL_INCLUDE_DIR})

message (STATUS "mysqlclient found: MYSQLCLIENT_LIB=${MYSQLCLIENT_LIB} MYSQL_INCLUDE_DIR=${MYSQL_INCLUDE_DIR} STATIC_MYSQLCLIENT_LIB=${STATIC_MYSQLCLIENT_LIB}")
4 changes: 2 additions & 2 deletions libs/libmysqlxx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ if (USE_STATIC_LIBRARIES)
add_dependencies (mysqlxx our_mysql_client)
set (Z_LIB zlibstatic)
else ()
set (Z_HINTS "/usr/local/opt/zlib/lib")
find_library (Z_LIB z HINTS ${Z_HINTS})
set (Z_PATHS "/usr/local/opt/zlib/lib" ${MYSQL_LIB_PATHS})
find_library (Z_LIB z PATHS ${Z_PATHS})
endif ()

target_link_libraries (mysqlxx common ${MYSQLCLIENT_LIB} ${OPENSSL_LIBRARIES} ${Z_LIB} ${PLATFORM_LIBS})
Expand Down

0 comments on commit 4bfa697

Please sign in to comment.