"Fossies" - the Fresh Open Source Software Archive

Member "icinga2-2.10.5/third-party/cmake/FindMySQL.cmake" (23 May 2019, 4601 Bytes) of package /linux/misc/icinga2-2.10.5.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) CMake source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #--------------------------------------------------------
    2 # Copyright (C) 1995-2007 MySQL AB
    3 #
    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.
    7 #
    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
   11 # distribution.
   12 #
   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.
   17 #
   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
   20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   21 #
   22 # The MySQL Connector/ODBC is licensed under the terms of the
   23 # GPL, like most MySQL Connectors. There are special exceptions
   24 # to the terms and conditions of the GPL as it is applied to
   25 # this software, see the FLOSS License Exception available on
   26 # mysql.com.
   27 
   28 ##########################################################################
   29 
   30 
   31 FILE(GLOB _macports_include_dirs /opt/local/include/mysql*/mysql)
   32 
   33 #-------------- FIND MYSQL_INCLUDE_DIR ------------------
   34 FIND_PATH(MYSQL_INCLUDE_DIR mysql.h
   35   $ENV{MYSQL_INCLUDE_DIR}
   36   $ENV{MYSQL_DIR}/include
   37   /usr/include/mysql
   38   /usr/local/include/mysql
   39   /opt/mysql/mysql/include
   40   /opt/mysql/mysql/include/mysql
   41   /opt/mysql/include
   42   /opt/local/include/mysql5
   43   /usr/local/mysql/include
   44   /usr/local/mysql/include/mysql
   45   ${_macports_include_dirs}
   46   $ENV{ProgramFiles}/MySQL/*/include
   47   $ENV{SystemDrive}/MySQL/*/include)
   48 
   49 UNSET(_macports_include_dirs)
   50 
   51 #----------------- FIND MYSQL_LIB_DIR -------------------
   52 IF (WIN32)
   53   SET(MYSQL_CLIENT_LIBS libmysql)
   54 
   55   # Set lib path suffixes
   56   # dist = for mysql binary distributions
   57   # build = for custom built tree
   58   IF (CMAKE_BUILD_TYPE STREQUAL Debug)
   59     SET(libsuffixDist debug)
   60     SET(libsuffixBuild Debug)
   61   ELSE (CMAKE_BUILD_TYPE STREQUAL Debug)
   62     SET(libsuffixDist opt)
   63     SET(libsuffixBuild Release)
   64     ADD_DEFINITIONS(-DDBUG_OFF)
   65   ENDIF (CMAKE_BUILD_TYPE STREQUAL Debug)
   66 
   67   FIND_LIBRARY(MYSQL_LIB NAMES mysqlclient
   68     PATHS
   69     $ENV{MYSQL_DIR}
   70     $ENV{MYSQL_DIR}/lib/${libsuffixDist}
   71     $ENV{MYSQL_DIR}/libmysql
   72     $ENV{MYSQL_DIR}/libmysql/${libsuffixBuild}
   73     $ENV{MYSQL_DIR}/client/${libsuffixBuild}
   74     $ENV{MYSQL_DIR}/libmysql/${libsuffixBuild}
   75     $ENV{ProgramFiles}/MySQL/*/lib/${libsuffixDist}
   76     $ENV{SystemDrive}/MySQL/*/lib/${libsuffixDist})
   77 ELSE (WIN32)
   78   IF (NOT MYSQL_CLIENT_LIBS)
   79     SET(MYSQL_CLIENT_LIBS mysqlclient mariadbclient)
   80   ENDIF (NOT MYSQL_CLIENT_LIBS)
   81 
   82   FILE(GLOB _macports_lib_dirs /opt/local/lib/mysql*/mysql)
   83 
   84   FIND_LIBRARY(MYSQL_LIB NAMES ${MYSQL_CLIENT_LIBS}
   85     PATHS
   86     $ENV{MYSQL_DIR}
   87     $ENV{MYSQL_DIR}/libmysql_r/.libs
   88     $ENV{MYSQL_DIR}/lib
   89     $ENV{MYSQL_DIR}/lib/mysql
   90     /usr/lib/mysql
   91     /usr/local/lib/mysql
   92     /usr/local/mysql/lib
   93     /usr/local/mysql/lib/mysql
   94     /opt/local/mysql5/lib
   95     /opt/local/lib/mysql5/mysql
   96     /opt/mysql/mysql/lib/mysql
   97     /opt/mysql/lib/mysql
   98     ${_macports_lib_dirs})
   99 
  100   UNSET(_macports_lib_dirs)
  101 ENDIF (WIN32)
  102 
  103 IF(MYSQL_LIB)
  104   GET_FILENAME_COMPONENT(MYSQL_LIB_DIR ${MYSQL_LIB} PATH)
  105 ENDIF(MYSQL_LIB)
  106 
  107 IF (MYSQL_INCLUDE_DIR AND MYSQL_LIB_DIR)
  108   SET(MYSQL_FOUND TRUE)
  109 
  110   INCLUDE_DIRECTORIES(${MYSQL_INCLUDE_DIR})
  111   LINK_DIRECTORIES(${MYSQL_LIB_DIR})
  112 
  113   FIND_LIBRARY(MYSQL_ZLIB zlib PATHS ${MYSQL_LIB_DIR})
  114   FIND_LIBRARY(MYSQL_YASSL yassl PATHS ${MYSQL_LIB_DIR})
  115   FIND_LIBRARY(MYSQL_TAOCRYPT taocrypt PATHS ${MYSQL_LIB_DIR})
  116 
  117   IF (MYSQL_ZLIB)
  118     SET(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} zlib)
  119   ENDIF (MYSQL_ZLIB)
  120   IF (MYSQL_YASSL)
  121     SET(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} yassl)
  122   ENDIF (MYSQL_YASSL)
  123   IF (MYSQL_TAOCRYPT)
  124     SET(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} taocrypt)
  125   ENDIF (MYSQL_TAOCRYPT)
  126   # Added needed mysqlclient dependencies on Windows
  127   IF (WIN32)
  128     SET(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} ws2_32)
  129   ENDIF (WIN32)
  130 
  131   MESSAGE(STATUS "MySQL Include dir: ${MYSQL_INCLUDE_DIR}  library dir: ${MYSQL_LIB_DIR}")
  132   MESSAGE(STATUS "MySQL client libraries: ${MYSQL_CLIENT_LIBS}")
  133 ELSE (MYSQL_INCLUDE_DIR AND MYSQL_LIB_DIR)
  134   MESSAGE(STATUS "Cannot find MySQL. Include dir: ${MYSQL_INCLUDE_DIR}  library dir: ${MYSQL_LIB_DIR}")
  135   SET(MYSQL_FOUND FALSE)
  136 ENDIF (MYSQL_INCLUDE_DIR AND MYSQL_LIB_DIR)