From 78c6249bd7a1a453920e2c82bc899fc8231d6d95 Mon Sep 17 00:00:00 2001 From: antao Date: Mon, 3 Dec 2018 18:39:44 +0800 Subject: [PATCH] Modify the drogon_ctl --- CMakeLists.txt | 2 +- drogon_ctl/templates/FindMySQL.csp | 13 ++----------- drogon_ctl/templates/cmake.csp | 2 -- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index de945bcb..5fa52fe4 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,7 +79,7 @@ if(MYSQL_FOUND) message(STATUS "libs:" ${MYSQL_CLIENT_LIBS}) message(STATUS "version:" ${MYSQL_VERSION_STRING}) if(MYSQL_VERSION_STRING STREQUAL "") - set(MYSQL_FOUND false) + set(MYSQL_FOUND false) message(STATUS "The mysql in your system is not the mariadb, so we can't use it in drogon") else() message(STATUS "Ok! We find the mariadb!") diff --git a/drogon_ctl/templates/FindMySQL.csp b/drogon_ctl/templates/FindMySQL.csp index 8c95985d..98fa5d3e 100644 --- a/drogon_ctl/templates/FindMySQL.csp +++ b/drogon_ctl/templates/FindMySQL.csp @@ -66,7 +66,7 @@ IF (WIN32) $ENV{ProgramFiles}/MySQL/*/lib/${libsuffixDist} $ENV{SystemDrive}/MySQL/*/lib/${libsuffixDist}) ELSE (WIN32) - FIND_LIBRARY(MYSQL_LIB NAMES mysqlclient_r mysqlclient + FIND_LIBRARY(MYSQL_LIB NAMES mysqlclient_r mariadbclient PATHS /usr/lib/mysql /usr/local/lib/mysql @@ -84,20 +84,11 @@ ENDIF(MYSQL_LIB) set(MYSQL_VERSION_STRING "") -if( MYSQL_INCLUDE_DIR AND EXISTS "${MYSQL_INCLUDE_DIR}/mariadb_version.h" ) - 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() +EXEC_PROGRAM (grep ARGS "MARIADB_BASE_VERSION ${MYSQL_INCLUDE_DIR}/*.h|awk '{print $3}'" OUTPUT_VARIABLE MYSQL_VERSION_STRING) IF (MYSQL_INCLUDE_DIR AND MYSQL_LIB_DIR) 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_TAOCRYPT taocrypt PATHS ${MYSQL_LIB_DIR}) IF (MYSQL_LIB) diff --git a/drogon_ctl/templates/cmake.csp b/drogon_ctl/templates/cmake.csp index d95f24c1..dcc40ae8 100644 --- a/drogon_ctl/templates/cmake.csp +++ b/drogon_ctl/templates/cmake.csp @@ -71,8 +71,6 @@ if(MYSQL_FOUND) message(STATUS "Ok! We find the mariadb!") include_directories(${MYSQL_INCLUDE_DIR}) link_libraries(${MYSQL_CLIENT_LIBS}) - aux_source_directory(${PROJECT_SOURCE_DIR}/orm_lib/src/mysql_impl DIR_SRCS) - set(USE_ORM TRUE) endif() endif()