2020-01-25 03:58:20 +00:00
|
|
|
# --------------------------------------------------------
|
2018-11-21 07:18:41 +00:00
|
|
|
# Copyright (C) 1995-2007 MySQL AB
|
|
|
|
#
|
2020-01-25 03:58:20 +00:00
|
|
|
# This program is free software; you can redistribute it and/or modify it under
|
|
|
|
# the terms of version 2 of the GNU General Public License as published by the
|
|
|
|
# Free Software Foundation.
|
2018-11-21 07:18:41 +00:00
|
|
|
#
|
2020-01-25 03:58:20 +00:00
|
|
|
# There are special exceptions to the terms and conditions of the GPL as it is
|
|
|
|
# applied to this software. View the full text of the exception in file
|
|
|
|
# LICENSE.exceptions in the top-level directory of this software distribution.
|
2018-11-21 07:18:41 +00:00
|
|
|
#
|
2020-01-25 03:58:20 +00:00
|
|
|
# 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.
|
2018-11-21 07:18:41 +00:00
|
|
|
#
|
2020-01-25 03:58:20 +00:00
|
|
|
# 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
|
|
|
|
# Street, Fifth Floor, Boston, MA 02110-1301, USA
|
2018-11-21 07:18:41 +00:00
|
|
|
#
|
2020-01-25 03:58:20 +00:00
|
|
|
# The MySQL Connector/ODBC is licensed under the terms of the GPL, like most
|
|
|
|
# MySQL Connectors. There are special exceptions to the terms and conditions of
|
|
|
|
# the GPL as it is applied to this software, see the FLOSS License Exception
|
|
|
|
# available on mysql.com.
|
2020-03-18 11:54:48 +00:00
|
|
|
# MySQL_lib - The imported target library.
|
2018-11-21 07:18:41 +00:00
|
|
|
|
2020-01-25 03:58:20 +00:00
|
|
|
# ##############################################################################
|
2018-11-21 07:18:41 +00:00
|
|
|
|
2020-03-18 11:54:48 +00:00
|
|
|
# -------------- FIND MYSQL_INCLUDE_DIRS ------------------
|
|
|
|
find_path(MYSQL_INCLUDE_DIRS
|
2020-01-25 03:58:20 +00:00
|
|
|
NAMES mysql.h
|
|
|
|
PATH_SUFFIXES mysql
|
|
|
|
PATHS /usr/include/mysql
|
|
|
|
/usr/local/include/mysql
|
2020-10-24 06:28:39 +00:00
|
|
|
/usr/include/mariadb
|
|
|
|
/usr/local/include/mariadb
|
2020-01-25 03:58:20 +00:00
|
|
|
/opt/mysql/mysql/include
|
|
|
|
/opt/mysql/mysql/include/mysql
|
|
|
|
/opt/mysql/include
|
|
|
|
/opt/local/include/mysql5
|
|
|
|
/usr/local/mysql/include
|
|
|
|
/usr/local/mysql/include/mysql
|
2020-10-24 06:28:39 +00:00
|
|
|
/usr/local/mariadb/include
|
|
|
|
/usr/local/mariadb/include/mariadb
|
2021-05-12 10:32:49 +00:00
|
|
|
/opt/rh/rh-mariadb105/root/usr/include
|
|
|
|
/opt/rh/rh-mariadb105/root/usr/include/mysql
|
2020-01-25 03:58:20 +00:00
|
|
|
$ENV{ProgramFiles}/MySQL/*/include
|
|
|
|
$ENV{SystemDrive}/MySQL/*/include)
|
2018-11-21 07:18:41 +00:00
|
|
|
|
2020-03-18 11:54:48 +00:00
|
|
|
if(EXISTS "${MYSQL_INCLUDE_DIRS}/mysql.h")
|
2018-11-21 07:18:41 +00:00
|
|
|
|
2020-03-18 11:54:48 +00:00
|
|
|
elseif(EXISTS "${MYSQL_INCLUDE_DIRS}/mysql/mysql.h")
|
|
|
|
set(MYSQL_INCLUDE_DIRS ${MYSQL_INCLUDE_DIRS}/mysql)
|
2020-01-25 03:58:20 +00:00
|
|
|
endif()
|
2018-11-21 07:18:41 +00:00
|
|
|
|
2020-03-18 11:54:48 +00:00
|
|
|
# ----------------- FIND MYSQL_LIBRARIES_DIR -------------------
|
2020-01-25 03:58:20 +00:00
|
|
|
if(WIN32)
|
|
|
|
# Set lib path suffixes dist = for mysql binary distributions build = for
|
|
|
|
# custom built tree
|
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL Debug)
|
|
|
|
set(libsuffixDist debug)
|
|
|
|
set(libsuffixBuild Debug)
|
|
|
|
else(CMAKE_BUILD_TYPE STREQUAL Debug)
|
|
|
|
set(libsuffixDist opt)
|
|
|
|
set(libsuffixBuild Release)
|
|
|
|
add_definitions(-DDBUG_OFF)
|
|
|
|
endif(CMAKE_BUILD_TYPE STREQUAL Debug)
|
2018-11-21 07:18:41 +00:00
|
|
|
|
2020-03-18 11:54:48 +00:00
|
|
|
find_library(MYSQL_LIBRARIES
|
2020-01-25 03:58:20 +00:00
|
|
|
NAMES mariadbclient
|
|
|
|
PATHS $ENV{MYSQL_DIR}/lib/${libsuffixDist}
|
|
|
|
$ENV{MYSQL_DIR}/libmysql
|
|
|
|
$ENV{MYSQL_DIR}/libmysql/${libsuffixBuild}
|
|
|
|
$ENV{MYSQL_DIR}/client/${libsuffixBuild}
|
|
|
|
$ENV{MYSQL_DIR}/libmysql/${libsuffixBuild}
|
|
|
|
$ENV{ProgramFiles}/MySQL/*/lib/${libsuffixDist}
|
|
|
|
$ENV{SystemDrive}/MySQL/*/lib/${libsuffixDist})
|
|
|
|
else(WIN32)
|
2020-03-18 11:54:48 +00:00
|
|
|
find_library(MYSQL_LIBRARIES
|
2020-01-25 03:58:20 +00:00
|
|
|
NAMES mysqlclient_r mariadbclient
|
|
|
|
PATHS /usr/lib/mysql
|
2021-02-17 02:02:52 +00:00
|
|
|
/usr/lib/mariadb
|
2020-01-25 03:58:20 +00:00
|
|
|
/usr/local/lib/mysql
|
2021-02-17 02:02:52 +00:00
|
|
|
/usr/local/lib/mariadb
|
2020-01-25 03:58:20 +00:00
|
|
|
/usr/local/mysql/lib
|
|
|
|
/usr/local/mysql/lib/mysql
|
|
|
|
/opt/local/mysql5/lib
|
|
|
|
/opt/local/lib/mysql5/mysql
|
|
|
|
/opt/mysql/mysql/lib/mysql
|
2021-05-12 10:32:49 +00:00
|
|
|
/opt/mysql/lib/mysql
|
|
|
|
/opt/rh/rh-mariadb105/root/usr/lib64)
|
2020-01-25 03:58:20 +00:00
|
|
|
endif(WIN32)
|
2018-11-21 07:18:41 +00:00
|
|
|
|
2020-03-18 11:54:48 +00:00
|
|
|
if(MYSQL_INCLUDE_DIRS AND MYSQL_LIBRARIES)
|
|
|
|
message(STATUS "MySQL Include dir: ${MYSQL_INCLUDE_DIRS}")
|
|
|
|
message(STATUS "MySQL client libraries: ${MYSQL_LIBRARIES}")
|
2020-01-25 03:58:20 +00:00
|
|
|
elseif(MySQL_FIND_REQUIRED)
|
|
|
|
message(
|
|
|
|
FATAL_ERROR
|
2020-03-18 11:54:48 +00:00
|
|
|
"Cannot find MySQL. Include dir: ${MYSQL_INCLUDE_DIRS} library dir: ${MYSQL_LIBRARIES_DIR}"
|
2020-01-25 03:58:20 +00:00
|
|
|
)
|
2020-03-18 11:54:48 +00:00
|
|
|
endif(MYSQL_INCLUDE_DIRS AND MYSQL_LIBRARIES)
|
|
|
|
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
find_package_handle_standard_args(MySQL
|
|
|
|
DEFAULT_MSG
|
|
|
|
MYSQL_LIBRARIES
|
|
|
|
MYSQL_INCLUDE_DIRS)
|
|
|
|
# Copy the results to the output variables.
|
|
|
|
if(MySQL_FOUND)
|
|
|
|
add_library(MySQL_lib INTERFACE IMPORTED)
|
|
|
|
set_target_properties(MySQL_lib
|
|
|
|
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
|
|
|
|
"${MYSQL_INCLUDE_DIRS}"
|
|
|
|
INTERFACE_LINK_LIBRARIES
|
|
|
|
"${MYSQL_LIBRARIES}")
|
|
|
|
else(MySQL_FOUND)
|
|
|
|
set(MYSQL_LIBRARIES)
|
|
|
|
set(MYSQL_INCLUDE_DIRS)
|
|
|
|
endif(MySQL_FOUND)
|
|
|
|
|
|
|
|
mark_as_advanced(MYSQL_INCLUDE_DIRS MYSQL_LIBRARIES)
|