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

问题描述 投票:0回答:2

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

c++ linux cmake mysql-connector
2个回答
0
投票

安装软件包 libmysqlclient-devmysql-client 相同的版本有帮助


0
投票

我还将使用旧版 JDBC API,因此我更改了 other/mysql/CMakeLists.txt 中配置选项的默认状态

您可以在根 CMakeLists.txt 中添加

set(WITH_JDBC ON)
或作为 cmake 命令选项给出
-DWITH_JDBC=ON
,而不是更改原始库。

© www.soinside.com 2019 - 2024. All rights reserved.