Bug #117763 Contribution: Clear the return variable from the CMake cache
Submitted: 20 Mar 15:06 Modified: 21 Mar 16:11
Reporter: OCA Admin (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / C++ Severity:S3 (Non-critical)
Version:9.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: Contribution

[20 Mar 15:06] OCA Admin
Description:
This bug tracks a contribution by Lenny Wu (Github user: TimeLooper), as described in http://github.com/mysql/mysql-connector-cpp/pull/37

How to repeat:
See description

Suggested fix:
See contribution code attached
[20 Mar 15:06] OCA Admin
Contribution submitted via Github - Clear the return variable from the CMake cache 
(*) Contribution by Lenny Wu (Github TimeLooper, mysql-connector-cpp/pull/37#issuecomment-2740006759): I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: git_patch_2390895134.txt (text/plain), 714 bytes.

[20 Mar 15:41] MySQL Verification Team
Hello Lenny Wu,

Thank you for the report and contribution.

regards,
Umesh
[21 Mar 5:05] Rafal Somla
Posted by developer:
 
Refined Problem Description
===========================
Our cmake files use NO_CACHE option for find_xxx() commands to prevent storing results of the search in the cache. However, the NO_CACHE option is supported by cmake 3.21+ and our build system should work with cmake 3.15+. The earlier cmake versions seem to ignore the option which leads to errors because find_xxx() does nothing if result variable is already stored in the cache.

Implemented solution
====================
Replace NO_CACHE option by explicit clearing of the cache variable before invoking find_xxx() commands.
[21 Mar 16:11] Daniel So
Posted by developer:
 
Added the following entry to the C/C++9.3.0 changelog: 

"The mysql-concpp module used the NO_CACHE CMake option, which was not supported for CMake 3.20 and earlier, making the find_ methods fail. This patch uses an implicit command to clear the cached variables instead, before the calls of the find_ methods. Thanks to Lenny Wu for contributing the fix."
[14 Apr 20:25] Daniel So
Posted by developer:
 
Corrected the changelog entry to the following: 

"The mysql-concpp module used the NO_CACHE CMake option, which was not supported for CMake 3.20 and earlier, making the find_ methods fail. This patch uses an explicit command to clear the cached variables instead, before the calls of the find_ methods. Thanks to Lenny Wu for contributing the fix."