diff options
author | flaviojs <flaviojs@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-06-29 12:26:51 +0000 |
---|---|---|
committer | flaviojs <flaviojs@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-06-29 12:26:51 +0000 |
commit | dd73c6ea546a8828653cdce38a52f575cbdd3b96 (patch) | |
tree | 7c388def15aaf5e09e73f563ffa39c72d7c28c2f /3rdparty/mysql/FindMYSQL.cmake | |
parent | a9492cf82f696af37f3258e19d7767f705708e63 (diff) | |
download | hercules-dd73c6ea546a8828653cdce38a52f575cbdd3b96.tar.gz hercules-dd73c6ea546a8828653cdce38a52f575cbdd3b96.tar.bz2 hercules-dd73c6ea546a8828653cdce38a52f575cbdd3b96.tar.xz hercules-dd73c6ea546a8828653cdce38a52f575cbdd3b96.zip |
* Added experimental support for CMake. (for now: basic build, no extras, only tested with VS10 and cygwin)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14872 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to '3rdparty/mysql/FindMYSQL.cmake')
-rw-r--r-- | 3rdparty/mysql/FindMYSQL.cmake | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/3rdparty/mysql/FindMYSQL.cmake b/3rdparty/mysql/FindMYSQL.cmake new file mode 100644 index 000000000..5ac264098 --- /dev/null +++ b/3rdparty/mysql/FindMYSQL.cmake @@ -0,0 +1,34 @@ +# - Find mysqlclient +# Find the native MySQL includes and library +# +# MYSQL_INCLUDE_DIR - where to find mysql.h, etc. +# MYSQL_LIBRARIES - List of libraries when using MySQL. +# MYSQL_FOUND - True if MySQL found. +# +# Based on: http://www.itk.org/Wiki/CMakeUserFindMySQL + +find_path( MYSQL_INCLUDE_DIR "mysql.h" + PATH_SUFFIXES "mysql" ) + +set( MYSQL_NAMES mysqlclient mysqlclient_r ) +find_library( MYSQL_LIBRARY + NAMES ${MYSQL_NAMES} + PATH_SUFFIXES "mysql" ) +mark_as_advanced( MYSQL_LIBRARY MYSQL_INCLUDE_DIR ) + +if( MYSQL_INCLUDE_DIR AND EXISTS "${MYSQL_INCLUDE_DIR}/mysql_version.h" ) + file( STRINGS "${MYSQL_INCLUDE_DIR}/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_LIBRARY MYSQL_INCLUDE_DIR + VERSION_VAR MYSQL_VERSION_STRING ) + +if( MYSQL_FOUND ) + set( MYSQL_LIBRARIES ${PCRE_LIBRARY} ) + set( MYSQL_INCLUDE_DIRS ${PCRE_INCLUDE_DIR} ) +endif() |