2010-05-06 00:08:41 +00:00
|
|
|
# - Find MySQL
|
|
|
|
# Find the MySQL includes and client library
|
|
|
|
# This module defines
|
|
|
|
# MYSQL_INCLUDE_DIR, where to find mysql.h
|
|
|
|
# MYSQL_LIBRARIES, the libraries needed to use MySQL.
|
|
|
|
# MYSQL_FOUND, If false, do not try to use MySQL.
|
|
|
|
#
|
|
|
|
# Copyright (c) 2006, Jaroslaw Staniek, <js@iidea.pl>
|
|
|
|
#
|
|
|
|
# Redistribution and use is allowed according to the terms of the BSD license.
|
|
|
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
|
|
|
|
|
|
|
IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
|
|
|
|
SET(MYSQL_FOUND TRUE)
|
|
|
|
|
2015-02-14 12:47:37 +00:00
|
|
|
ELSE()
|
2010-05-06 00:08:41 +00:00
|
|
|
|
|
|
|
FIND_PATH(MYSQL_INCLUDE_DIR mysql.h
|
2019-05-01 01:27:50 +00:00
|
|
|
PATH_SUFFIXES mysql mariadb
|
2016-01-03 18:35:44 +00:00
|
|
|
PATHS
|
2010-05-06 00:08:41 +00:00
|
|
|
/usr/include/mysql
|
2019-05-01 01:27:50 +00:00
|
|
|
/usr/include/mariadb
|
2010-05-06 00:08:41 +00:00
|
|
|
/usr/local/include/mysql
|
2019-05-01 01:27:50 +00:00
|
|
|
/usr/local/include/mariadb
|
2010-05-20 12:26:05 +00:00
|
|
|
/opt/local/include/mysql5/mysql
|
2016-01-03 18:17:44 +00:00
|
|
|
/opt/local/include/mysql55/mysql
|
|
|
|
/opt/local/include/mysql51/mysql
|
2010-05-06 00:08:41 +00:00
|
|
|
$ENV{ProgramFiles}/MySQL/*/include
|
|
|
|
$ENV{SystemDrive}/MySQL/*/include)
|
|
|
|
|
|
|
|
IF(WIN32 AND MSVC)
|
2019-05-01 01:27:50 +00:00
|
|
|
FIND_LIBRARY(MYSQL_LIBRARY_RELEASE NAMES libmysql mysqlclient libmariadb mariadbclient
|
2010-09-20 19:37:15 +00:00
|
|
|
PATHS
|
|
|
|
$ENV{ProgramFiles}/MySQL/*/lib/opt
|
|
|
|
$ENV{SystemDrive}/MySQL/*/lib/opt)
|
2019-05-01 01:27:50 +00:00
|
|
|
FIND_LIBRARY(MYSQL_LIBRARY_DEBUG NAMES libmysqld mysqlclientd libmariadb mariadbclient
|
2010-05-06 00:08:41 +00:00
|
|
|
PATHS
|
|
|
|
$ENV{ProgramFiles}/MySQL/*/lib/opt
|
|
|
|
$ENV{SystemDrive}/MySQL/*/lib/opt)
|
2015-02-14 12:47:37 +00:00
|
|
|
ELSE()
|
2019-05-01 01:27:50 +00:00
|
|
|
FIND_LIBRARY(MYSQL_LIBRARY_RELEASE NAMES mysqlclient mariadbclient
|
2010-09-20 19:37:15 +00:00
|
|
|
PATHS
|
|
|
|
/usr/lib
|
|
|
|
/usr/local/lib
|
2019-05-01 01:27:50 +00:00
|
|
|
/usr/lib/mariadb
|
2010-09-20 19:37:15 +00:00
|
|
|
/usr/lib/mysql
|
|
|
|
/usr/local/lib/mysql
|
2019-05-01 01:27:50 +00:00
|
|
|
/usr/local/lib/mariadb
|
2010-09-20 19:37:15 +00:00
|
|
|
/opt/local/lib/mysql5/mysql
|
2016-01-03 18:17:44 +00:00
|
|
|
/opt/local/lib/mysql55/mysql
|
|
|
|
/opt/local/lib/mysql51/mysql
|
2010-09-20 19:37:15 +00:00
|
|
|
)
|
|
|
|
|
2019-05-01 01:27:50 +00:00
|
|
|
FIND_LIBRARY(MYSQL_LIBRARY_DEBUG NAMES mysqlclientd mariadbclientd
|
2010-05-06 00:08:41 +00:00
|
|
|
PATHS
|
|
|
|
/usr/lib
|
|
|
|
/usr/local/lib
|
|
|
|
/usr/lib/mysql
|
|
|
|
/usr/local/lib/mysql
|
2010-05-20 12:26:05 +00:00
|
|
|
/opt/local/lib/mysql5/mysql
|
2016-01-03 18:17:44 +00:00
|
|
|
/opt/local/lib/mysql55/mysql
|
|
|
|
/opt/local/lib/mysql51/mysql
|
2010-05-06 00:08:41 +00:00
|
|
|
)
|
2015-02-14 12:47:37 +00:00
|
|
|
ENDIF()
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2010-09-20 19:37:15 +00:00
|
|
|
IF(MYSQL_INCLUDE_DIR)
|
|
|
|
IF(MYSQL_LIBRARY_RELEASE)
|
|
|
|
IF(MYSQL_LIBRARY_DEBUG)
|
2015-02-14 12:47:37 +00:00
|
|
|
SET(MYSQL_LIBRARIES optimized ${MYSQL_LIBRARY_RELEASE} debug ${MYSQL_LIBRARY_DEBUG})
|
|
|
|
ELSE()
|
|
|
|
SET(MYSQL_LIBRARIES ${MYSQL_LIBRARY_RELEASE})
|
|
|
|
ENDIF()
|
2012-04-11 21:43:11 +00:00
|
|
|
FIND_PACKAGE(OpenSSL)
|
|
|
|
IF(OPENSSL_FOUND)
|
2017-10-03 12:32:13 +00:00
|
|
|
IF(WIN32)
|
|
|
|
SET(OPENSSL_LIBRARIES ${OPENSSL_LIBRARIES} Crypt32.lib)
|
|
|
|
ENDIF()
|
2012-04-11 21:43:11 +00:00
|
|
|
SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} ${OPENSSL_LIBRARIES})
|
2015-02-14 12:47:37 +00:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2010-09-20 19:37:15 +00:00
|
|
|
|
2019-10-08 05:37:56 +00:00
|
|
|
IF(WITH_STATIC)
|
|
|
|
IF(UNIX)
|
|
|
|
FIND_PACKAGE(gnutls)
|
|
|
|
IF(GNUTLS_FOUND)
|
|
|
|
SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} ${GNUTLS_LIBRARY})
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
|
2010-05-06 00:08:41 +00:00
|
|
|
IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
|
|
|
|
SET(MYSQL_FOUND TRUE)
|
|
|
|
MESSAGE(STATUS "Found MySQL: ${MYSQL_INCLUDE_DIR}, ${MYSQL_LIBRARIES}")
|
2019-05-01 01:27:50 +00:00
|
|
|
IF (MYSQL_LIBRARIES MATCHES "libmariadb" OR MYSQL_LIBRARIES MATCHES "mariadbclient")
|
|
|
|
SET(MARIADB_FOUND TRUE)
|
|
|
|
MESSAGE(STATUS "Found MariaDB.")
|
|
|
|
ENDIF()
|
2015-02-14 12:47:37 +00:00
|
|
|
ELSE()
|
2010-05-06 00:08:41 +00:00
|
|
|
SET(MYSQL_FOUND FALSE)
|
|
|
|
MESSAGE(STATUS "MySQL not found.")
|
2015-02-14 12:47:37 +00:00
|
|
|
ENDIF()
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2010-09-20 19:37:15 +00:00
|
|
|
MARK_AS_ADVANCED(MYSQL_LIBRARY_RELEASE MYSQL_LIBRARY_DEBUG)
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2015-02-14 12:47:37 +00:00
|
|
|
ENDIF()
|