2020-06-05 01:02:26 -06:00
|
|
|
# - Try to find MySQL.
|
|
|
|
# Once done this will define:
|
|
|
|
# MYSQL_FOUND - If false, do not try to use MySQL.
|
|
|
|
# MYSQL_INCLUDE_DIRS - Where to find mysql.h, etc.
|
|
|
|
# MYSQL_LIBRARIES - The libraries to link against.
|
|
|
|
# MYSQL_VERSION_STRING - Version in a string of MySQL.
|
2007-08-19 05:51:53 -06:00
|
|
|
#
|
2020-06-05 01:02:26 -06:00
|
|
|
# Created by RenatoUtsch based on eAthena implementation.
|
2014-11-01 04:06:30 -06:00
|
|
|
#
|
2020-06-05 01:02:26 -06:00
|
|
|
# Please note that this module only supports Windows and Linux officially, but
|
|
|
|
# should work on all UNIX-like operational systems too.
|
2014-11-01 04:06:30 -06:00
|
|
|
#
|
2020-06-05 01:02:26 -06:00
|
|
|
|
|
|
|
#=============================================================================
|
|
|
|
# Copyright 2012 RenatoUtsch
|
2014-11-01 04:06:30 -06:00
|
|
|
#
|
2020-06-05 01:02:26 -06:00
|
|
|
# Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
# see accompanying file Copyright.txt for details.
|
2014-11-01 04:06:30 -06:00
|
|
|
#
|
2020-06-05 01:02:26 -06:00
|
|
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
# See the License for more information.
|
|
|
|
#=============================================================================
|
|
|
|
# (To distribute this file outside of CMake, substitute the full
|
|
|
|
# License text for the above reference.)
|
|
|
|
|
|
|
|
if( WIN32 )
|
|
|
|
set(MYENV "PROGRAMFILES(X86)")
|
|
|
|
find_path( MYSQL_INCLUDE_DIR
|
|
|
|
NAMES "mysql.h"
|
|
|
|
PATHS "$ENV{PROGRAMFILES}/MySQL/*/include"
|
|
|
|
"$ENV{${MYENV}}/MySQL/*/include"
|
|
|
|
"$ENV{SYSTEMDRIVE}/MySQL/*/include" )
|
|
|
|
|
|
|
|
find_library( MYSQL_LIBRARY
|
|
|
|
NAMES "mysqlclient" "mysqlclient_r" "libmysql"
|
|
|
|
PATHS "$ENV{PROGRAMFILES}/MySQL/*/lib"
|
|
|
|
"$ENV{${MYENV}}/MySQL/*/lib"
|
|
|
|
"$ENV{SYSTEMDRIVE}/MySQL/*/lib" )
|
|
|
|
else()
|
|
|
|
find_path( MYSQL_INCLUDE_DIR
|
|
|
|
NAMES "mysql.h"
|
|
|
|
PATHS "/usr/include/mysql"
|
|
|
|
"/usr/local/include/mysql"
|
|
|
|
"/usr/mysql/include/mysql" )
|
|
|
|
|
|
|
|
find_library( MYSQL_LIBRARY
|
|
|
|
NAMES "mysqlclient" "mysqlclient_r"
|
|
|
|
PATHS "/lib/mysql"
|
|
|
|
"/lib64/mysql"
|
|
|
|
"/usr/lib/mysql"
|
|
|
|
"/usr/lib64/mysql"
|
|
|
|
"/usr/local/lib/mysql"
|
|
|
|
"/usr/local/lib64/mysql"
|
|
|
|
"/usr/mysql/lib/mysql"
|
|
|
|
"/usr/mysql/lib64/mysql" )
|
|
|
|
endif()
|
2014-11-02 12:31:52 -07:00
|
|
|
|
|
|
|
|
2020-06-05 01:02:26 -06:00
|
|
|
IF (MYSQL_INCLUDE_DIR AND MYSQL_LIBRARY)
|
2014-11-02 12:31:52 -07:00
|
|
|
SET(MYSQL_FOUND TRUE)
|
2020-06-05 01:02:26 -06:00
|
|
|
SET( MYSQL_LIBRARIES ${MYSQL_LIBRARY} )
|
|
|
|
ELSE (MYSQL_INCLUDE_DIR AND MYSQL_LIBRARY)
|
|
|
|
SET(MYSQL_FOUND FALSE)
|
|
|
|
SET( MYSQL_LIBRARIES )
|
|
|
|
ENDIF (MYSQL_INCLUDE_DIR AND MYSQL_LIBRARY)
|
2014-11-02 12:31:52 -07:00
|
|
|
|
2020-06-05 01:02:26 -06:00
|
|
|
IF (MYSQL_FOUND)
|
|
|
|
MESSAGE(STATUS "Found MySQL: ${MYSQL_LIBRARY}")
|
|
|
|
ELSE (MYSQL_FOUND)
|
|
|
|
IF (MySQL_FIND_REQUIRED)
|
|
|
|
MESSAGE(STATUS "Looked for MySQL libraries named ${MYSQL_NAMES}.")
|
|
|
|
MESSAGE(FATAL_ERROR "Could NOT find MySQL library")
|
|
|
|
ENDIF (MySQL_FIND_REQUIRED)
|
|
|
|
ENDIF (MYSQL_FOUND)
|
2014-11-02 12:31:52 -07:00
|
|
|
|
2020-06-05 01:02:26 -06:00
|
|
|
MARK_AS_ADVANCED(
|
|
|
|
MYSQL_LIBRARY
|
|
|
|
MYSQL_INCLUDE_DIR
|
|
|
|
)
|