Skip to content

Clear the return variable from the CMake cache #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

TimeLooper
Copy link
Contributor

No description provided.

@mysql-oca-bot
Copy link

Hi, thank you for submitting this pull request. In order to consider your code we need you to sign the Oracle Contribution Agreement (OCA). Please review the details and follow the instructions at https://oca.opensource.oracle.com/
Please make sure to include your MySQL bug system user (email) in the returned form.
Thanks

@mysql-oca-bot
Copy link

Hi, thank you for your contribution. Please confirm this code is submitted under the terms of the OCA (Oracle's Contribution Agreement) you have previously signed by cutting and pasting the following text as a comment:
"I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it."
Thanks

@TimeLooper
Copy link
Contributor Author

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

@mysql-oca-bot
Copy link

Hi, thank you for your contribution. Your code has been assigned to an internal queue. Please follow
bug http://bugs.mysql.com/bug.php?id=117763 for updates.
Thanks

@@ -880,6 +880,7 @@ function(find_imp_lib var base_name path)
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib)

#message("!!! Looking for import library for: ${path}")
unset(${var} CACHE)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the problem this is fixing?

@TimeLooper
Copy link
Contributor Author

TimeLooper commented Mar 20, 2025 via email

@rsomla1
Copy link
Contributor

rsomla1 commented Mar 21, 2025

When I used this cmake file to import the JDBC library, the actual linked file in the final generated vcxproj file was mysqlcppconnx.lib, not mysqlcppconn.lib. This was because the function was called twice to obtain the file paths of the two libraries, resulting in the second direct read of the cmake cache and ultimately causing an error.

Right. I asked because the find_library() invocation explicitly says NO_CACHE to prevent storing the value of ${var} in the cache.

  find_library(${var}
    NAMES ${base_name}
    PATHS ${base_path}
    PATH_SUFFIXES ${vs_suffix}
    NO_DEFAULT_PATH
    NO_CACHE
  )

However, I checked that NO_CACHE option requires cmake version 3.21+ and we try to support 3.15 at this point. So I will merge your fix and also do similar thing in few other places where NO_CACHE is used. Thanks for the patch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants