【发布时间】:2022-06-11 01:20:24
【问题描述】:
我正在尝试将 MySQL Connector/C++ (8.0.29) 添加到我的项目中。我是从源代码作为子模块这样做的
add_subdirectory(other/mysql)
我还将使用旧版 JDBC API,因此我更改了 other/mysql/CMakeLists.txt 中配置选项的默认状态
add_config_option(WITH_JDBC BOOL DEFAULT ON
"Whether to build a variant of connector library which implements legacy JDBC API"
)
但是当我尝试配置项目时,它会说
Legacy library soversion: 9
Looking for MySQL Client library:
CMake Error at other/mysql/jdbc/cmake/DepFindMySQL.cmake:135 (message):
Could not find MySQL headers at:
Point at MySQL client library location using WITH_MYSQL or
MYSQL_INCLUDE_DIR, MYSQL_LIB_DIR settings.
Call Stack (most recent call first):
other/mysql/jdbc/cmake/DepFindMySQL.cmake:615 (main)
other/mysql/cdk/cmake/dependency.cmake:45 (include)
other/mysql/jdbc/CMakeLists.txt:147 (find_dependency)
-- Configuring incomplete, errors occurred!
我已经安装了 mysql-client(5.7.38-1ubuntu18.04) 包,但我不知道该怎么做
【问题讨论】:
-
对于 build 使用库的东西,您需要一个 dev 包:libmysqlclient-dev.
-
@Tsyvarev 哦,是的,我有这个包的更新版本,安装 5.7 有帮助。谢谢
标签: c++ linux cmake mysql-connector