Bug #99093 mysql-connector-cpp cmake files not work well when as a third party
Submitted: 27 Mar 2020 3:52 Modified: 3 Apr 2020 14:08
Reporter: lou shuai (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / C++ Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[27 Mar 2020 3:52] lou shuai
Description:
When using mysql-connector-cpp as a third-party code,
mysql-connector-cpp will not compile correctly as a  third party.

How to repeat:
git clone https://github.com/louishust/xdev-demo.git
cd xdev-demo
git submodule init
git submodule update
mkdir bld
cd bld
cmake ..
make

will got the following error:

/tmp/xdev-demo/third_party/mysql-connector-cpp/common/session.cc:45:10: fatal error: config.h: No such file or directory
 #include "config.h"
          ^~~~~~~~~~

Suggested fix:
the patch is available in attachment

cd xdev-demo/third_party/mysql-connector-cpp
git apply patch.diff

Then recompile the xdev-demo project with make.
[27 Mar 2020 3:53] lou shuai
Fix cmake error

Attachment: patch.diff (application/octet-stream, text), 1.53 KiB.

[30 Mar 2020 1:59] lou shuai
fix the bug

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: patch (2).diff (application/octet-stream, text), 1.53 KiB.

[30 Mar 2020 8:46] Terje Røsten
Thanks!
[3 Apr 2020 9:05] Rafal Somla
Posted by developer:
 
Thanks for the patch. We will use it to fix our build system so that it can be used as a sub-project. Note however, that a typical use scenario we support is to build connector in a separate project, install it somewhere and then use it in your project from that install location (for example define imported lib target in cmake).
[3 Apr 2020 10:30] lou shuai
Got it
[3 Apr 2020 14:08] Paul DuBois
Posted by developer:
 
Fixed in 8.0.21.

The CMake configuration files were revised to work better when
Connector/C++ is used as a subproject of application projects. Thanks
to Lou Shuai for the contribution.

This revision does not change the fact that the intended (and
supported) usage scenario is to build the connector in a separate
project, install it somewhere and then use it in application projects
from that installed location (for example, by defining the imported
library target in CMake).