2 # Find the MySQL includes and client library
4 # MYSQL_INCLUDE_DIR, where to find mysql.h
5 # MYSQL_LIBRARIES, the libraries needed to use MySQL.
6 # MYSQL_FOUND, If false, do not try to use MySQL.
8 # Copyright (c) 2006, Jaroslaw Staniek, <js@iidea.pl>
10 # Redistribution and use is allowed according to the terms of the BSD license.
11 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
13 IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
18 FIND_PATH(MYSQL_INCLUDE_DIR mysql.h
19 PATH_SUFFIXES mysql mariadb
23 /usr/local/include/mysql
24 /usr/local/include/mariadb
25 /opt/local/include/mysql5/mysql
26 /opt/local/include/mysql55/mysql
27 /opt/local/include/mysql51/mysql
28 $ENV{ProgramFiles}/MySQL/*/include
29 $ENV{SystemDrive}/MySQL/*/include)
32 FIND_LIBRARY(MYSQL_LIBRARY_RELEASE NAMES libmysql mysqlclient libmariadb mariadbclient
34 $ENV{ProgramFiles}/MySQL/*/lib/opt
35 $ENV{SystemDrive}/MySQL/*/lib/opt)
36 FIND_LIBRARY(MYSQL_LIBRARY_DEBUG NAMES libmysqld mysqlclientd libmariadb mariadbclient
38 $ENV{ProgramFiles}/MySQL/*/lib/opt
39 $ENV{SystemDrive}/MySQL/*/lib/opt)
41 FIND_LIBRARY(MYSQL_LIBRARY_RELEASE NAMES mysqlclient mariadbclient
48 /usr/local/lib/mariadb
49 /opt/local/lib/mysql5/mysql
50 /opt/local/lib/mysql55/mysql
51 /opt/local/lib/mysql51/mysql
54 FIND_LIBRARY(MYSQL_LIBRARY_DEBUG NAMES mysqlclientd mariadbclientd
60 /opt/local/lib/mysql5/mysql
61 /opt/local/lib/mysql55/mysql
62 /opt/local/lib/mysql51/mysql
67 IF(MYSQL_LIBRARY_RELEASE)
68 IF(MYSQL_LIBRARY_DEBUG)
69 SET(MYSQL_LIBRARIES optimized ${MYSQL_LIBRARY_RELEASE} debug ${MYSQL_LIBRARY_DEBUG})
71 SET(MYSQL_LIBRARIES ${MYSQL_LIBRARY_RELEASE})
76 SET(OPENSSL_LIBRARIES ${OPENSSL_LIBRARIES} Crypt32.lib)
78 SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} ${OPENSSL_LIBRARIES})
83 IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
85 MESSAGE(STATUS "Found MySQL: ${MYSQL_INCLUDE_DIR}, ${MYSQL_LIBRARIES}")
86 IF (MYSQL_LIBRARIES MATCHES "libmariadb" OR MYSQL_LIBRARIES MATCHES "mariadbclient")
87 SET(MARIADB_FOUND TRUE)
88 MESSAGE(STATUS "Found MariaDB.")
91 SET(MYSQL_FOUND FALSE)
92 MESSAGE(STATUS "MySQL not found.")
95 MARK_AS_ADVANCED(MYSQL_LIBRARY_RELEASE MYSQL_LIBRARY_DEBUG)