我正在尝试将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)包,但我不知道该怎么办
2条答案
按热度按时间yr9zkbsy1#
安装与mysql-client相同版本的软件包libmysqlclient-dev有助于
oknwwptz2#
您可以在根目录CMakeLists.txt中添加
set(WITH_JDBC ON)
,或者给予cmake命令选项-DWITH_JDBC=ON
,而不是更改原始库。