summaryrefslogtreecommitdiff
path: root/3rdparty/cmake/FindMYSQL.cmake
diff options
context:
space:
mode:
authorflaviojs <flaviojs@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-07-10 15:29:57 +0000
committerflaviojs <flaviojs@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-07-10 15:29:57 +0000
commitf817e3714747b39a364e99c536e0b802b24fd2c3 (patch)
tree4feb82dd35e6d4b647dde3716f3fb2463aef0398 /3rdparty/cmake/FindMYSQL.cmake
parentee66778144c8a069a04d5f77ec73dcab973c61d0 (diff)
downloadhercules-f817e3714747b39a364e99c536e0b802b24fd2c3.tar.gz
hercules-f817e3714747b39a364e99c536e0b802b24fd2c3.tar.bz2
hercules-f817e3714747b39a364e99c536e0b802b24fd2c3.tar.xz
hercules-f817e3714747b39a364e99c536e0b802b24fd2c3.zip
* CMake: lowered required version to 2.8.3 and moved custom cmake modules to 3rdparty/cmake.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14897 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to '3rdparty/cmake/FindMYSQL.cmake')
-rw-r--r--3rdparty/cmake/FindMYSQL.cmake35
1 files changed, 35 insertions, 0 deletions
diff --git a/3rdparty/cmake/FindMYSQL.cmake b/3rdparty/cmake/FindMYSQL.cmake
new file mode 100644
index 000000000..0a07f3612
--- /dev/null
+++ b/3rdparty/cmake/FindMYSQL.cmake
@@ -0,0 +1,35 @@
+# - Find mysqlclient
+# Find the native MySQL includes and library
+#
+# MYSQL_INCLUDE_DIRS - where to find mysql.h, etc.
+# MYSQL_LIBRARIES - mysqlclient library.
+# MYSQL_FOUND - True if mysqlclient is found.
+#
+
+find_path( MYSQL_INCLUDE_DIRS "mysql.h"
+ PATHS
+ "/usr/include/mysql"
+ "/usr/local/include/mysql"
+ "$ENV{PROGRAMFILES}/MySQL/*/include"
+ "$ENV{SYSTEMDRIVE}/MySQL/*/include" )
+
+find_library( MYSQL_LIBRARIES
+ NAMES "mysqlclient" "mysqlclient_r"
+ PATHS
+ "/usr/lib/mysql"
+ "/usr/local/lib/mysql"
+ "$ENV{PROGRAMFILES}/MySQL/*/lib"
+ "$ENV{SYSTEMDRIVE}/MySQL/*/lib" )
+mark_as_advanced( MYSQL_LIBRARIES MYSQL_INCLUDE_DIRS )
+
+if( MYSQL_INCLUDE_DIRS AND EXISTS "${MYSQL_INCLUDE_DIRS}/mysql_version.h" )
+ file( STRINGS "${MYSQL_INCLUDE_DIRS}/mysql_version.h" MYSQL_VERSION_H REGEX "^#define[ \t]+MYSQL_SERVER_VERSION[ \t]+\"[^\"]+\".*$" )
+ string( REGEX REPLACE "^.*MYSQL_SERVER_VERSION[ \t]+\"([^\"]+)\".*$" "\\1" MYSQL_VERSION_STRING "${MYSQL_VERSION_H}" )
+endif()
+
+# handle the QUIETLY and REQUIRED arguments and set MYSQL_FOUND to TRUE if
+# all listed variables are TRUE
+include( FindPackageHandleStandardArgs )
+FIND_PACKAGE_HANDLE_STANDARD_ARGS( MYSQL
+ REQUIRED_VARS MYSQL_LIBRARIES MYSQL_INCLUDE_DIRS
+ VERSION_VAR MYSQL_VERSION_STRING )