From ab9b60f5c4501eb8d7bec4a053d73fc723ea31b5 Mon Sep 17 00:00:00 2001 From: flaviojs Date: Sat, 9 Jul 2011 07:39:27 +0000 Subject: * CMake: added search for math library, made CPack existence optional, updated the search for mysqlclient and corrected misspelled variables (tested with FreeBSD-8.2-i386) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14893 54d463be-8e91-2dee-dedb-b68131a5f0ec --- 3rdparty/mysql/CMakeLists.txt | 23 ++++------------------- 3rdparty/mysql/FindMYSQL.cmake | 39 ++++++++++++++++++++------------------- 2 files changed, 24 insertions(+), 38 deletions(-) (limited to '3rdparty') diff --git a/3rdparty/mysql/CMakeLists.txt b/3rdparty/mysql/CMakeLists.txt index 3f792281c..f4996907f 100644 --- a/3rdparty/mysql/CMakeLists.txt +++ b/3rdparty/mysql/CMakeLists.txt @@ -42,25 +42,10 @@ endif( WIN32 ) # system # message( STATUS "Detecting system MYSQL" ) -find_program( MYSQL_CONFIG_EXECUTABLE "mysql_config" ) -mark_as_advanced( MYSQL_CONFIG_EXECUTABLE ) -if( MYSQL_CONFIG_EXECUTABLE ) - # use mysql_config data - message( "Found mysql_config: ${MYSQL_CONFIG_EXECUTABLE}" ) - execute_process( COMMAND "${MYSQL_CONFIG_EXECUTABLE} --libs" - OUTPUT_VARIABLE MYSQL_LIBRARIES ) - execute_process( COMMAND "${MYSQL_CONFIG_EXECUTABLE} --include" - OUTPUT_VARIABLE MYSQL_INCLUDE_DIRS ) - execute_process( COMMAND "${MYSQL_CONFIG_EXECUTABLE} --version" - OUTPUT_VARIABLE MYSQL_VERSION ) - message( STATUS "Found MYSQL: ${MYSQL_LIBRARIES} (found version ${MYSQL_VERSION})" ) -else() - # find mysql package - unset( MYSQL_LIBRARIES CACHE ) - unset( MYSQL_INCLUDE_DIRS CACHE ) - set( CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_MODULE_PATH} ) - find_package( MYSQL ) -endif() +unset( MYSQL_LIBRARIES CACHE ) +unset( MYSQL_INCLUDE_DIRS CACHE ) +set( CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_MODULE_PATH} ) +find_package( MYSQL ) set( MYSQL_SYSTEM_LIBRARIES "${MYSQL_LIBRARIES}" CACHE PATH "system mysql libraries" ) set( MYSQL_SYSTEM_INCLUDE_DIRS "${MYSQL_INCLUDE_DIRS}" diff --git a/3rdparty/mysql/FindMYSQL.cmake b/3rdparty/mysql/FindMYSQL.cmake index 5ac264098..0a07f3612 100644 --- a/3rdparty/mysql/FindMYSQL.cmake +++ b/3rdparty/mysql/FindMYSQL.cmake @@ -1,23 +1,29 @@ # - 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. +# MYSQL_INCLUDE_DIRS - where to find mysql.h, etc. +# MYSQL_LIBRARIES - mysqlclient library. +# MYSQL_FOUND - True if mysqlclient is found. # -# Based on: http://www.itk.org/Wiki/CMakeUserFindMySQL -find_path( MYSQL_INCLUDE_DIR "mysql.h" - PATH_SUFFIXES "mysql" ) +find_path( MYSQL_INCLUDE_DIRS "mysql.h" + PATHS + "/usr/include/mysql" + "/usr/local/include/mysql" + "$ENV{PROGRAMFILES}/MySQL/*/include" + "$ENV{SYSTEMDRIVE}/MySQL/*/include" ) -set( MYSQL_NAMES mysqlclient mysqlclient_r ) -find_library( MYSQL_LIBRARY - NAMES ${MYSQL_NAMES} - PATH_SUFFIXES "mysql" ) -mark_as_advanced( MYSQL_LIBRARY MYSQL_INCLUDE_DIR ) +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_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]+\"[^\"]+\".*$" ) +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() @@ -25,10 +31,5 @@ endif() # all listed variables are TRUE include( FindPackageHandleStandardArgs ) FIND_PACKAGE_HANDLE_STANDARD_ARGS( MYSQL - REQUIRED_VARS MYSQL_LIBRARY MYSQL_INCLUDE_DIR + REQUIRED_VARS MYSQL_LIBRARIES MYSQL_INCLUDE_DIRS VERSION_VAR MYSQL_VERSION_STRING ) - -if( MYSQL_FOUND ) - set( MYSQL_LIBRARIES ${PCRE_LIBRARY} ) - set( MYSQL_INCLUDE_DIRS ${PCRE_INCLUDE_DIR} ) -endif() -- cgit v1.2.3-70-g09d2