1 #--------------------------------------------------------
2 # Copyright (C) 1995-2007 MySQL AB
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of version 2 of the GNU General Public License as
6 # published by the Free Software Foundation.
8 # There are special exceptions to the terms and conditions of the GPL
9 # as it is applied to this software. View the full text of the exception
10 # in file LICENSE.exceptions in the top-level directory of this software
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
21 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 # The MySQL Connector/ODBC is licensed under the terms of the
24 # GPL, like most MySQL Connectors. There are special exceptions
25 # to the terms and conditions of the GPL as it is applied to
26 # this software, see the FLOSS License Exception available on
29 ##########################################################################
32 #-------------- FIND MYSQL_INCLUDE_DIR ------------------
33 FIND_PATH(MYSQL_INCLUDE_DIR mysql.h
35 /usr/local/include/mysql
36 /opt/mysql/mysql/include
37 /opt/mysql/mysql/include/mysql
39 /opt/local/include/mysql5
40 /usr/local/mysql/include
41 /usr/local/mysql/include/mysql
42 $ENV{ProgramFiles}/MySQL/*/include
43 $ENV{SystemDrive}/MySQL/*/include)
45 #----------------- FIND MYSQL_LIB_DIR -------------------
47 # Set lib path suffixes
48 # dist = for mysql binary distributions
49 # build = for custom built tree
50 IF (CMAKE_BUILD_TYPE STREQUAL Debug)
51 SET(libsuffixDist debug)
52 SET(libsuffixBuild Debug)
53 ELSE (CMAKE_BUILD_TYPE STREQUAL Debug)
54 SET(libsuffixDist opt)
55 SET(libsuffixBuild Release)
56 ADD_DEFINITIONS(-DDBUG_OFF)
57 ENDIF (CMAKE_BUILD_TYPE STREQUAL Debug)
59 FIND_LIBRARY(MYSQL_LIB NAMES mysqlclient
61 $ENV{MYSQL_DIR}/lib/${libsuffixDist}
62 $ENV{MYSQL_DIR}/libmysql
63 $ENV{MYSQL_DIR}/libmysql/${libsuffixBuild}
64 $ENV{MYSQL_DIR}/client/${libsuffixBuild}
65 $ENV{MYSQL_DIR}/libmysql/${libsuffixBuild}
66 $ENV{ProgramFiles}/MySQL/*/lib/${libsuffixDist}
67 $ENV{SystemDrive}/MySQL/*/lib/${libsuffixDist})
69 FIND_LIBRARY(MYSQL_LIB NAMES mysqlclient_r mysqlclient
74 /usr/local/mysql/lib/mysql
76 /opt/local/lib/mysql5/mysql
77 /opt/mysql/mysql/lib/mysql
82 GET_FILENAME_COMPONENT(MYSQL_LIB_DIR ${MYSQL_LIB} PATH)
85 IF (MYSQL_INCLUDE_DIR AND MYSQL_LIB_DIR)
88 INCLUDE_DIRECTORIES(${MYSQL_INCLUDE_DIR})
89 LINK_DIRECTORIES(${MYSQL_LIB_DIR})
91 FIND_LIBRARY(MYSQL_ZLIB zlib PATHS ${MYSQL_LIB_DIR})
92 FIND_LIBRARY(MYSQL_TAOCRYPT taocrypt PATHS ${MYSQL_LIB_DIR})
94 SET(MYSQL_CLIENT_LIBS ${MYSQL_LIB})
96 SET(MYSQL_CLIENT_LIBS mysqlclient_r)
99 SET(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} zlib)
102 SET(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} taocrypt)
103 ENDIF (MYSQL_TAOCRYPT)
104 # Added needed mysqlclient dependencies on Windows
106 SET(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} ws2_32)
109 MESSAGE(STATUS "MySQL Include dir: ${MYSQL_INCLUDE_DIR} library dir: ${MYSQL_LIB_DIR}")
110 MESSAGE(STATUS "MySQL client libraries: ${MYSQL_CLIENT_LIBS}")
111 ELSEIF (MySQL_FIND_REQUIRED)
112 MESSAGE(FATAL_ERROR "Cannot find MySQL. Include dir: ${MYSQL_INCLUDE_DIR} library dir: ${MYSQL_LIB_DIR}")
113 ENDIF (MYSQL_INCLUDE_DIR AND MYSQL_LIB_DIR)