Cmake on macOS error: Could not find MySQL headers

Cmake on macOS error: Could not find MySQL headers

当 运行 cmake 命令在 macOS Mojave 上编译 AzerothCore 时,我使用参数:

-DMYSQL_ADD_INCLUDE_PATH=/usr/local/include
-DMYSQL_LIBRARY=/usr/local/lib/libmysqlclient_r.dylib

但是 cmake 失败并出现以下错误:

CMake Error at src/cmake/macros/FindMySQL.cmake:179 (message): Could not find MySQL headers! Please install the development libraries and
headers Call Stack (most recent call first): CMakeLists.txt:93 (find_package)

我通过使用 brew 安装和链接 mysql56 来解决:

brew install mysql56

brew link mysql56 --force