Modify cmake files for the mariadb database on linux
This commit is contained in:
parent
1e7fe48d80
commit
ffbdac36c9
|
@ -79,6 +79,7 @@ if(MYSQL_FOUND)
|
||||||
message(STATUS "libs:" ${MYSQL_CLIENT_LIBS})
|
message(STATUS "libs:" ${MYSQL_CLIENT_LIBS})
|
||||||
message(STATUS "version:" ${MYSQL_VERSION_STRING})
|
message(STATUS "version:" ${MYSQL_VERSION_STRING})
|
||||||
if(MYSQL_VERSION_STRING STREQUAL "")
|
if(MYSQL_VERSION_STRING STREQUAL "")
|
||||||
|
set(MYSQL_FOUND false)
|
||||||
message(STATUS "The mysql in your system is not the mariadb, so we can't use it in drogon")
|
message(STATUS "The mysql in your system is not the mariadb, so we can't use it in drogon")
|
||||||
else()
|
else()
|
||||||
message(STATUS "Ok! We find the mariadb!")
|
message(STATUS "Ok! We find the mariadb!")
|
||||||
|
|
|
@ -66,7 +66,7 @@ IF (WIN32)
|
||||||
$ENV{ProgramFiles}/MySQL/*/lib/${libsuffixDist}
|
$ENV{ProgramFiles}/MySQL/*/lib/${libsuffixDist}
|
||||||
$ENV{SystemDrive}/MySQL/*/lib/${libsuffixDist})
|
$ENV{SystemDrive}/MySQL/*/lib/${libsuffixDist})
|
||||||
ELSE (WIN32)
|
ELSE (WIN32)
|
||||||
FIND_LIBRARY(MYSQL_LIB NAMES mysqlclient_r mysqlclient
|
FIND_LIBRARY(MYSQL_LIB NAMES mariadbclient
|
||||||
PATHS
|
PATHS
|
||||||
/usr/lib/mysql
|
/usr/lib/mysql
|
||||||
/usr/local/lib/mysql
|
/usr/local/lib/mysql
|
||||||
|
@ -84,20 +84,11 @@ ENDIF(MYSQL_LIB)
|
||||||
|
|
||||||
set(MYSQL_VERSION_STRING "")
|
set(MYSQL_VERSION_STRING "")
|
||||||
|
|
||||||
if( MYSQL_INCLUDE_DIR AND EXISTS "${MYSQL_INCLUDE_DIR}/mariadb_version.h" )
|
EXEC_PROGRAM (grep ARGS "MARIADB_BASE_VERSION ${MYSQL_INCLUDE_DIR}/*.h|awk '{print $3}'" OUTPUT_VARIABLE MYSQL_VERSION_STRING)
|
||||||
file( STRINGS "${MYSQL_INCLUDE_DIR}/mariadb_version.h"
|
|
||||||
MYSQL_VERSION_H REGEX "^#define[ \t]+MARIADB_CLIENT_VERSION_STR[ \t]+\"[^\"]+\".*$" )
|
|
||||||
string( REGEX REPLACE
|
|
||||||
"^.*MARIADB_CLIENT_VERSION_STR[ \t]+\"([^\"]+)\".*$" "\\1" MYSQL_VERSION_STRING
|
|
||||||
"${MYSQL_VERSION_H}" )
|
|
||||||
endif()
|
|
||||||
|
|
||||||
IF (MYSQL_INCLUDE_DIR AND MYSQL_LIB_DIR)
|
IF (MYSQL_INCLUDE_DIR AND MYSQL_LIB_DIR)
|
||||||
SET(MYSQL_FOUND TRUE)
|
SET(MYSQL_FOUND TRUE)
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(${MYSQL_INCLUDE_DIR})
|
|
||||||
LINK_DIRECTORIES(${MYSQL_LIB_DIR})
|
|
||||||
|
|
||||||
FIND_LIBRARY(MYSQL_ZLIB zlib PATHS ${MYSQL_LIB_DIR})
|
FIND_LIBRARY(MYSQL_ZLIB zlib PATHS ${MYSQL_LIB_DIR})
|
||||||
FIND_LIBRARY(MYSQL_TAOCRYPT taocrypt PATHS ${MYSQL_LIB_DIR})
|
FIND_LIBRARY(MYSQL_TAOCRYPT taocrypt PATHS ${MYSQL_LIB_DIR})
|
||||||
IF (MYSQL_LIB)
|
IF (MYSQL_LIB)
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
link_libraries(drogon trantor pthread dl)
|
link_libraries(drogon trantor pthread dl)
|
||||||
|
|
||||||
add_executable(db_test db_test.cc users.cc)
|
add_executable(db_test db_test.cc Users.cc)
|
||||||
|
|
Loading…
Reference in New Issue