1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; version 2 of the
# License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
# 02110-1301 USA
# - Find mysql client library and includes
#
# MYSQL_FOUND - True if mysql was found
# MYSQL_INCLUDE_DIRS - the include dir where mysql.h lives
# MYSQL_LIBRARIES - list of mysql libraries
if (MYSQL_LIBRARIES AND MYSQL_INCLUDE_DIRS)
# in cache already, be silent and skip the rest
set(MYSQL_FOUND TRUE)
else ()
if (MYSQL_CONFIG_PATH)
EXEC_PROGRAM(${MYSQL_CONFIG_PATH} ARGS --variable=pkgincludedir RETURN_VALUE _return_VALUE OUTPUT_VARIABLE MYSQL_INCLUDE_DIRS)
if (NOT _return_VALUE)
EXEC_PROGRAM(${MYSQL_CONFIG_PATH} ARGS --libs RETURN_VALUE _return_VALUE OUTPUT_VARIABLE MYSQL_LIBRARIES)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MySQL DEFAULT_MSG
MYSQL_INCLUDE_DIRS MYSQL_LIBRARIES
)
mark_as_advanced(MYSQL_INCLUDE_DIRS MYSQL_LIBRARIES)
else ()
MESSAGE(FATAL_ERROR "Cannot find ${MYSQL_CONFIG_PATH} (MYSQL_CONFIG_PATH)")
endif ()
else ()
# Find the include dir:
FIND_PATH(MYSQL_INCLUDE_DIRS mysql.h
/usr/include/mysql
/usr/local/include/mysql
/opt/mysql/mysql/include
/opt/mysql/mysql/include/mysql
/usr/local/mysql/include
/usr/local/mysql/include/mysql
$ENV{ProgramFiles}/MySQL/*/include
$ENV{SystemDrive}/MySQL/*/include
)
# Find the library:
SET(MYSQL_LIBRARY_NAMES mysqlclient mysqlclient_r)
FIND_LIBRARY(MYSQL_LIBRARIES
NAMES ${MYSQL_LIBRARY_NAMES}
PATHS /usr/lib
/usr/local/lib
/usr/local/mysql/lib
/opt/mysql/mysql/lib
$ENV{ProgramFiles}/MySQL/*/lib
PATH_SUFFIXES mysql
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MySQL DEFAULT_MSG
MYSQL_INCLUDE_DIRS MYSQL_LIBRARIES
)
mark_as_advanced(MYSQL_INCLUDE_DIRS MYSQL_LIBRARIES)
endif ()
endif ()
|