1#   BAREOS® - Backup Archiving REcovery Open Sourced
2#
3#   Copyright (C) 2017-2017 Bareos GmbH & Co. KG
4#
5#   This program is Free Software; you can redistribute it and/or
6#   modify it under the terms of version three of the GNU Affero General Public
7#   License as published by the Free Software Foundation and included
8#   in the file LICENSE.
9#
10#   This program is distributed in the hope that it will be useful, but
11#   WITHOUT ANY WARRANTY; without even the implied warranty of
12#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13#   Affero General Public License for more details.
14#
15#   You should have received a copy of the GNU Affero General Public License
16#   along with this program; if not, write to the Free Software
17#   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18#   02110-1301, USA.
19
20# * Find mysqlclient Find the native MySQL includes and library
21#
22# MYSQL_INCLUDE_DIR - where to find mysql.h, etc. MYSQL_LIBRARIES   - List of
23# libraries when using MySQL. MYSQL_FOUND       - True if MySQL found.
24
25if(MYSQL_INCLUDE_DIR)
26  # Already in cache, be silent
27  set(MYSQL_FIND_QUIETLY TRUE)
28endif(MYSQL_INCLUDE_DIR)
29
30find_path(MYSQL_INCLUDE_DIR mysql.h /usr/local/include/mysql /usr/include/mysql)
31
32set(MYSQL_NAMES mysqlclient mysqlclient_r)
33find_library(
34  MYSQL_LIBRARY
35  NAMES ${MYSQL_NAMES}
36  PATHS /usr/lib /usr/local/lib
37  PATH_SUFFIXES mysql
38)
39
40if(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARY)
41  set(MYSQL_FOUND TRUE)
42  set(MYSQL_LIBRARIES ${MYSQL_LIBRARY})
43else(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARY)
44  set(MYSQL_FOUND FALSE)
45  set(MYSQL_LIBRARIES)
46endif(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARY)
47
48if(MYSQL_FOUND)
49  if(NOT MYSQL_FIND_QUIETLY)
50    message(STATUS "Found MySQL: ${MYSQL_LIBRARY}")
51  endif(NOT MYSQL_FIND_QUIETLY)
52else(MYSQL_FOUND)
53  if(MYSQL_FIND_REQUIRED)
54    message(STATUS "Looked for MySQL libraries named ${MYSQL_NAMES}.")
55    message(FATAL_ERROR "Could NOT find MySQL library")
56  endif(MYSQL_FIND_REQUIRED)
57endif(MYSQL_FOUND)
58
59mark_as_advanced(MYSQL_LIBRARY MYSQL_INCLUDE_DIR)
60