From 91204db81a4cefc5d8f1e010dad36a6aa7962e54 Mon Sep 17 00:00:00 2001 From: HarpyWar Date: Sun, 2 Nov 2014 22:31:52 +0300 Subject: [PATCH] Update FindMySQL.cmake https://github.com/HarpyWar/pvpgn/issues/116 (fix for the commit https://github.com/HarpyWar/pvpgn/commit/8b17eefadfab7ea7c6329713f3544c5d5b581e22) --- cmake/Modules/FindMySQL.cmake | 45 ++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/cmake/Modules/FindMySQL.cmake b/cmake/Modules/FindMySQL.cmake index 2d0f5c2..4fdc0ef 100644 --- a/cmake/Modules/FindMySQL.cmake +++ b/cmake/Modules/FindMySQL.cmake @@ -54,25 +54,26 @@ else() "/usr/mysql/lib/mysql" "/usr/mysql/lib64/mysql" ) endif() - - - -if( MYSQL_INCLUDE_DIR 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 DEFAULT_MSG - REQUIRED_VARS MYSQL_LIBRARY MYSQL_INCLUDE_DIR - VERSION_VAR MYSQL_VERSION_STRING ) - -set( MYSQL_INCLUDE_DIRS ${MYSQL_INCLUDE_DIR} ) -set( MYSQL_LIBRARIES ${MYSQL_LIBRARY} ) - -mark_as_advanced( MYSQL_INCLUDE_DIR MYSQL_LIBRARY ) \ No newline at end of file + + +IF (MYSQL_INCLUDE_DIR AND MYSQL_LIBRARY) + SET(MYSQL_FOUND TRUE) + 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) + +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) + +MARK_AS_ADVANCED( + MYSQL_LIBRARY + MYSQL_INCLUDE_DIR +) \ No newline at end of file