From 6f8306c2b8ee8ec77dd740010786dbe1cc1b3430 Mon Sep 17 00:00:00 2001 From: LinZhihao-723 Date: Sat, 9 Nov 2024 21:13:52 -0500 Subject: [PATCH] Fix --- components/core/cmake/Modules/FindMariaDBClient.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/components/core/cmake/Modules/FindMariaDBClient.cmake b/components/core/cmake/Modules/FindMariaDBClient.cmake index 543f31a6b..e02117763 100644 --- a/components/core/cmake/Modules/FindMariaDBClient.cmake +++ b/components/core/cmake/Modules/FindMariaDBClient.cmake @@ -20,6 +20,17 @@ include(cmake/Modules/FindLibraryDependencies.cmake) find_package(PkgConfig) pkg_check_modules(mariadbclient_PKGCONF QUIET "lib${mariadbclient_LIBNAME}") +if (NOT mariadbclient_PKGCONF_FOUND AND APPLE) + execute_process(COMMAND brew --prefix mariadb-connector-c OUTPUT_VARIABLE mariadb_MACOS_PREFIX) + string(STRIP "${mariadb_MACOS_PREFIX}" mariadb_MACOS_PREFIX) + set(CMAKE_PREFIX_PATH "${mariadb_MACOS_PREFIX};${CMAKE_PREFIX_PATH}") + pkg_check_modules(mariadbclient_PKGCONF QUIET "lib${mariadbclient_LIBNAME}") +endif() + +if (NOT mariadbclient_PKGCONF_FOUND) + message(FATAL_ERROR "pkg_config cannot find mariadb") +endif () + # Set include directory find_path(MariaDBClient_INCLUDE_DIR mysql.h HINTS ${mariadbclient_PKGCONF_INCLUDEDIR}