MySQL Connector/C++ 8.0X with JDBC找不到MySQL Client(CMake)

bogh5gae  于 2023-10-20  发布在  Mysql
关注(0)|答案(2)|浏览(141)

我正在尝试将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)包,但我不知道该怎么办

yr9zkbsy

yr9zkbsy1#

安装与mysql-client相同版本的软件包libmysqlclient-dev有助于

oknwwptz

oknwwptz2#

  • 我也将使用传统的JDBC API,所以我改变了其他/mysql/CMakeLists.txt中配置选项的默认状态 *

您可以在根目录CMakeLists.txt中添加set(WITH_JDBC ON),或者给予cmake命令选项-DWITH_JDBC=ON,而不是更改原始库。

相关问题