Skip to content
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

CMake config: version 8 is compatible with version 7 #10819

Closed
wants to merge 1 commit into from

Conversation

dg0yt
Copy link
Contributor

@dg0yt dg0yt commented Mar 22, 2023

AFAIU curl version 8.0.0 does bring any breaking API changes. However, the change of the major version has the effect that the CMake config is not considered compatible for find_package(CURL 7.123 CONFIG), breaking downstream usage, e.g.
azure-core-cpp

CMake Error at D:/installed/x64-windows-static/share/curl/vcpkg-cmake-wrapper.cmake:11 (_find_package):
  Could not find a configuration file for package "CURL" that is compatible
  with requested version "7.44".

  The following configuration files were considered but not accepted:

    D:/installed/x64-windows-static/share/curl/CURLConfig.cmake, version: 8.0.0-DEV

kubernetes:

CMake Error at D:/installed/x64-windows-static/share/curl/vcpkg-cmake-wrapper.cmake:11 (_find_package):
  Could not find a configuration file for package "CURL" that is compatible
  with requested version "7.58.0".

  The following configuration files were considered but not accepted:

    D:/installed/x64-windows-static/share/curl/CURLConfig.cmake, version: 8.0.0-DEV

This PR changes the default version check to accept version 8 as a compatible major version if version 7 is requested.

@bagder
Copy link
Member

bagder commented Mar 23, 2023

Someone needs to help me with this. I don't understand the description nor the patch.

@jzakrzewski
Copy link
Contributor

I understand the problematic but don't yet know, if this is how one should go about the fix.

Basically CMake has a concept of "compatible version". By default it's "same major version". Since curls' major changed, when looking for version like "7.44", "8.x.x" is deemed incompatible when using standard version-file.

@dg0yt
Copy link
Contributor Author

dg0yt commented Mar 23, 2023

Doc is there: https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-version-selection

For CMake config, it is up to the package to define what is a compatible version, through script code in the version cmake file. Based on the requested version from the find_package call, CMake sets some input variables for the version file, and it is up to the version file to decide.

CURL uses a CMake function to generate a version file with the "same major version" policy, i.e. any newer version is accepted if it is the same major version. e.g. 8.0.1 would satisfy the request for version 8.0.0 because 8.0.1 is newer and the major version is 8. But it wouldn't satisfy the request for 7.44 because it is a different major version.

This PR adds code before the actual version check which turns a request for 7.44 into a request for 8 by inspecting and modifying the version interface variables before passing control to the generated version check.

@dg0yt
Copy link
Contributor Author

dg0yt commented Mar 23, 2023

Alternatively one could generate the version checking code with the AnyNewerVersion policy, but this would change behaviour for find_package(CURL 6.12.3 CONFIG).

@jzakrzewski
Copy link
Contributor

Yeah, AnyNewerVersion is not the way to go as it may have unintended consequences.
I think this change make sense as it is.

@bagder bagder closed this in 2ffd787 Mar 24, 2023
@bagder
Copy link
Member

bagder commented Mar 24, 2023

Thanks, both!

bch pushed a commit to bch/curl that referenced this pull request Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

3 participants