2017-04-19 00:25:57 +00:00
|
|
|
option (ENABLE_MYSQL "Enable MySQL" ON)
|
2017-04-14 19:38:56 +00:00
|
|
|
|
|
|
|
if (ENABLE_MYSQL)
|
|
|
|
set (MYSQL_LIB_PATHS
|
|
|
|
"/usr/local/opt/mysql/lib"
|
2018-06-11 09:02:12 +00:00
|
|
|
"/usr/local/lib"
|
|
|
|
"/usr/local/lib64"
|
2018-07-25 11:29:26 +00:00
|
|
|
"/usr/local/lib/mariadb" # macos brew mariadb-connector-c
|
2018-06-11 09:02:12 +00:00
|
|
|
"/usr/mysql/lib"
|
|
|
|
"/usr/mysql/lib64"
|
|
|
|
"/usr/lib"
|
|
|
|
"/usr/lib64"
|
|
|
|
"/lib"
|
|
|
|
"/lib64")
|
2017-04-14 19:38:56 +00:00
|
|
|
|
|
|
|
set (MYSQL_INCLUDE_PATHS
|
|
|
|
"/usr/local/opt/mysql/include"
|
2018-06-11 09:02:12 +00:00
|
|
|
"/usr/mysql/include"
|
|
|
|
"/usr/local/include"
|
|
|
|
"/usr/include")
|
2017-01-12 12:17:54 +00:00
|
|
|
|
2018-07-25 11:29:26 +00:00
|
|
|
find_path (MYSQL_INCLUDE_DIR NAMES mysql/mysql.h mariadb/mysql.h PATHS ${MYSQL_INCLUDE_PATHS} PATH_SUFFIXES mysql)
|
2017-04-14 19:38:56 +00:00
|
|
|
|
|
|
|
if (USE_STATIC_LIBRARIES)
|
2018-06-11 09:02:12 +00:00
|
|
|
find_library (STATIC_MYSQLCLIENT_LIB NAMES mariadbclient mysqlclient PATHS ${MYSQL_LIB_PATHS} PATH_SUFFIXES mysql)
|
2017-04-14 19:38:56 +00:00
|
|
|
else ()
|
2018-07-25 11:29:26 +00:00
|
|
|
find_library (MYSQLCLIENT_LIBRARIES NAMES mariadb mariadbclient mysqlclient PATHS ${MYSQL_LIB_PATHS} PATH_SUFFIXES mysql)
|
2017-04-14 19:38:56 +00:00
|
|
|
endif ()
|
2017-08-31 17:11:30 +00:00
|
|
|
|
|
|
|
if (MYSQL_INCLUDE_DIR AND (STATIC_MYSQLCLIENT_LIB OR MYSQLCLIENT_LIBRARIES))
|
2017-09-04 17:04:33 +00:00
|
|
|
set (USE_MYSQL 1)
|
2017-09-24 12:41:29 +00:00
|
|
|
set (MYSQLXX_LIBRARY mysqlxx)
|
2018-07-25 15:27:31 +00:00
|
|
|
if (APPLE)
|
|
|
|
# /usr/local/include/mysql/mysql_com.h:1011:10: fatal error: mysql/udf_registration_types.h: No such file or directory
|
|
|
|
set(MYSQL_INCLUDE_DIR ${MYSQL_INCLUDE_DIR} ${MYSQL_INCLUDE_DIR}/mysql)
|
|
|
|
endif ()
|
2017-04-14 19:38:56 +00:00
|
|
|
endif ()
|
|
|
|
endif ()
|
2017-01-12 12:17:54 +00:00
|
|
|
|
2017-04-19 01:06:29 +00:00
|
|
|
if (USE_MYSQL)
|
2017-09-04 17:04:33 +00:00
|
|
|
message (STATUS "Using mysqlclient=${USE_MYSQL}: ${MYSQL_INCLUDE_DIR} : ${MYSQLCLIENT_LIBRARIES}; staticlib=${STATIC_MYSQLCLIENT_LIB}")
|
2017-04-19 01:06:29 +00:00
|
|
|
else ()
|
|
|
|
message (STATUS "Build without mysqlclient (support for MYSQL dictionary source will be disabled)")
|
|
|
|
endif ()
|