diff --git a/CMakeLists.txt b/CMakeLists.txt index 209add97e..2e5bf88cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,10 @@ if (${CMAKE_VERSION} GREATER_EQUAL 3.28) cmake_policy(SET CMP0153 OLD) endif () +if(POLICY CMP0153) + cmake_policy(SET CMP0153 NEW) # The exec_program() command should not be called +endif() + # Set projectname (must be done AFTER setting configurationtypes) project(WarheadBand VERSION 3.0.0 LANGUAGES CXX C) @@ -152,4 +156,4 @@ if (BUILD_TESTING AND BUILD_APPLICATION_WORLDSERVER) COMMAND genhtml -o ${CMAKE_CURRENT_SOURCE_DIR}/coverage-report coverage.info WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" ) -endif() +endif() \ No newline at end of file diff --git a/src/cmake/macros/FindMySQL.cmake b/src/cmake/macros/FindMySQL.cmake index df461ff95..6fbd77cd8 100644 --- a/src/cmake/macros/FindMySQL.cmake +++ b/src/cmake/macros/FindMySQL.cmake @@ -126,18 +126,20 @@ if( UNIX ) if( MYSQL_CONFIG ) message(STATUS "Using mysql-config: ${MYSQL_CONFIG}") # set INCLUDE_DIR - exec_program(${MYSQL_CONFIG} - ARGS --include + execute_process( + COMMAND "${MYSQL_CONFIG}" --include OUTPUT_VARIABLE MY_TMP + OUTPUT_STRIP_TRAILING_WHITESPACE ) string(REGEX REPLACE "-I([^ ]*)( .*)?" "\\1" MY_TMP "${MY_TMP}") set(MYSQL_ADD_INCLUDE_PATH ${MY_TMP} CACHE FILEPATH INTERNAL) #message("[DEBUG] MYSQL ADD_INCLUDE_PATH : ${MYSQL_ADD_INCLUDE_PATH}") # set LIBRARY_DIR - exec_program(${MYSQL_CONFIG} - ARGS --libs_r + execute_process( + COMMAND "${MYSQL_CONFIG}" --libs_r OUTPUT_VARIABLE MY_TMP + OUTPUT_STRIP_TRAILING_WHITESPACE ) set(MYSQL_ADD_LIBRARIES "") string(REGEX MATCHALL "-l[^ ]*" MYSQL_LIB_LIST "${MY_TMP}") @@ -153,7 +155,7 @@ if( UNIX ) string(REGEX REPLACE "[ ]*-L([^ ]*)" "\\1" LIB "${LIB}") list(APPEND MYSQL_ADD_LIBRARIES_PATH "${LIB}") #message("[DEBUG] MYSQL ADD_LIBRARIES_PATH : ${MYSQL_ADD_LIBRARIES_PATH}") - endforeach(LIB ${MYSQL_LIBS}) + endforeach(LIB) else( MYSQL_CONFIG ) set(MYSQL_ADD_LIBRARIES "") @@ -196,7 +198,7 @@ if( UNIX ) foreach(LIB ${MYSQL_ADD_LIBRARIES}) find_library( MYSQL_LIBRARY NAMES - mysql libmysql ${LIB} + mysql libmariadb libmysql ${LIB} PATHS ${MYSQL_ADD_LIBRARIES_PATH} /usr/lib @@ -206,7 +208,7 @@ if( UNIX ) /usr/local/mysql/lib DOC "Specify the location of the mysql library here." ) - endforeach(LIB ${MYSQL_ADD_LIBRARY}) + endforeach(LIB) endif( UNIX ) if( WIN32 ) @@ -260,7 +262,7 @@ else( NOT WIN32 ) endif( NOT WIN32 ) if( UNIX ) - find_program(MYSQL_EXECUTABLE mysql + find_program(MYSQL_EXECUTABLE mariadb mysql PATHS ${MYSQL_CONFIG_PREFER_PATH} /usr/local/mysql/bin/ @@ -303,4 +305,4 @@ if( MYSQL_LIBRARY ) mark_as_advanced( MYSQL_FOUND MYSQL_LIBRARY MYSQL_EXTRA_LIBRARIES MYSQL_INCLUDE_DIR MYSQL_EXECUTABLE ) else( MYSQL_LIBRARY ) message(FATAL_ERROR "Could not find the MySQL libraries! Please install the development libraries and headers") -endif( MYSQL_LIBRARY ) +endif( MYSQL_LIBRARY ) \ No newline at end of file diff --git a/src/server/database/Updater/DBUpdater.cpp b/src/server/database/Updater/DBUpdater.cpp index 7990bff96..f45590f6a 100644 --- a/src/server/database/Updater/DBUpdater.cpp +++ b/src/server/database/Updater/DBUpdater.cpp @@ -360,7 +360,7 @@ void DBUpdater::ApplyFile(DatabaseWorkerPool& pool, std::string_view host, std:: std::string_view port_or_socket, std::string_view database, std::string_view ssl, Path const& path) { std::vector args; - args.reserve(9); + args.reserve(10); // Add password from extra file args.emplace_back(Warhead::StringFormat("--defaults-extra-file={}", pool.GetPathToExtraFile())); @@ -401,6 +401,12 @@ void DBUpdater::ApplyFile(DatabaseWorkerPool& pool, std::string_view host, std:: #else if (ssl == "ssl") args.emplace_back("--ssl"); + else + { +#ifdef MARIADB_VERSION_ID && MARIADB_VERSION_ID > 110000 + args.emplace_back("--ssl=0"); +#endif + } #endif // Execute sql file @@ -426,4 +432,4 @@ void DBUpdater::ApplyFile(DatabaseWorkerPool& pool, std::string_view host, std:: throw UpdateException("update failed"); } -} +} \ No newline at end of file