Skip to content

Commit

Permalink
Apply code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
LinZhihao-723 committed Nov 10, 2024
1 parent e882a49 commit 26f03e5
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions components/core/cmake/Modules/FindMariaDBClient.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,22 @@ 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}")
execute_process(
COMMAND brew --prefix mariadb-connector-c
RESULT_VARIABLE brew_result
OUTPUT_VARIABLE mariadbclient_MACOS_PREFIX
ERROR_QUIET
)
if(NOT brew_result EQUAL 0)
message(FATAL_ERROR "mariadb-connector-c not found in Homebrew")
endif()
string(STRIP "${mariadbclient_MACOS_PREFIX}" mariadbclient_MACOS_PREFIX)
list(PREPEND CMAKE_PREFIX_PATH ${mariadbclient_MACOS_PREFIX})
pkg_check_modules(mariadbclient_PKGCONF QUIET "lib${mariadbclient_LIBNAME}")
endif()

if(NOT mariadbclient_PKGCONF_FOUND)
message(FATAL_ERROR "pkg_config cannot find mariadb")
message(FATAL_ERROR "PkgConfig cannot find mariadb")
endif()

# Set include directory
Expand Down

0 comments on commit 26f03e5

Please sign in to comment.