Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cmake): Add Homebrew path detection for mariadb-connector-c to fix macOS build failure. #582

Merged
merged 5 commits into from
Nov 10, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions components/core/cmake/Modules/FindMariaDBClient.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
LinZhihao-723 marked this conversation as resolved.
Show resolved Hide resolved
string(STRIP "${mariadb_MACOS_PREFIX}" mariadb_MACOS_PREFIX)
set(CMAKE_PREFIX_PATH "${mariadb_MACOS_PREFIX};${CMAKE_PREFIX_PATH}")
LinZhihao-723 marked this conversation as resolved.
Show resolved Hide resolved
pkg_check_modules(mariadbclient_PKGCONF QUIET "lib${mariadbclient_LIBNAME}")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might not need QUIET here

Suggested change
pkg_check_modules(mariadbclient_PKGCONF QUIET "lib${mariadbclient_LIBNAME}")
pkg_check_modules(mariadbclient_PKGCONF "lib${mariadbclient_LIBNAME}")

LinZhihao-723 marked this conversation as resolved.
Show resolved Hide resolved
endif()
LinZhihao-723 marked this conversation as resolved.
Show resolved Hide resolved

if(NOT mariadbclient_PKGCONF_FOUND)
message(FATAL_ERROR "pkg_config cannot find mariadb")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a placeholder error message. May need a more meaningful fatal log

endif()

# Set include directory
find_path(MariaDBClient_INCLUDE_DIR mysql.h
HINTS ${mariadbclient_PKGCONF_INCLUDEDIR}
Expand Down
Loading