Bug #86427 Execute CMake error
Submitted: 23 May 2017 11:11 Modified: 23 May 2017 15:41
Reporter: er Wang Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / C++ Severity:S3 (Non-critical)
Version:1.1.9 OS:Ubuntu (16.04)
Assigned to: CPU Architecture:Any
Tags: CMake 3.5.2

[23 May 2017 11:11] er Wang
Description:
CMake version: 3.5.2
(1) Downloaded mysql-connector-cpp-1.1.9.tar.gz from GitHub.
(2) Executed the command:
cmake . -DBOOST_ROOT=/usr/local/boost_1_64_0
The error:
-- Boost version: 1.64.0
-- BOOST_INCLUDE_DIRS=/usr/local/boost_1_64_0
-- You will link dynamically to the MySQL client library (set with -DMYSQLCLIENT_STATIC_LINKING=<bool>)
-- Searching for dynamic libraries with the base name(s) "mysqlclient_r mysqlclient"
-- mysql_config was found /usr/local/mysql/bin/mysql_config
CMake Error at FindMySQL.cmake:406 (message):
  Could not find dynamic "mysqlclient_r mysqlclient" in MYSQL_LIB_DIR
  "/usr/local/mysql/lib"
Call Stack (most recent call first):
  FindMySQL.cmake:649 (_check_lib_search_error)
  CMakeLists.txt:252 (INCLUDE)

-- Configuring incomplete, errors occurred!
See also "/home/yangwenbin/mysql-connector-cpp-1.1.9/CMakeFiles/CMakeOutput.log".
See also "/home/yangwenbin/mysql-connector-cpp-1.1.9/CMakeFiles/CMakeError.log".

How to repeat:
Executed the command:
(1) cd mysql-connector-cpp-1.1.9
(2) cmake . -DBOOST_ROOT=/usr/local/boost_1_64_0

Suggested fix:
Change the line 641 of mysql-connector-cpp-1.1.9/FindMySQL.cmake:
    list(GET MYSQL_LIBRARIES 0 _search_libs)
to
    list(GET MYSQL_LIBRARIES 0 ${_search_libs})
[23 May 2017 15:41] er Wang
Sorry, I am wrong.
[23 May 2017 20:29] MySQL Verification Team
Hi,

Thanks for both the report and the self-fix :D

all best
Bogdan