-
Notifications
You must be signed in to change notification settings - Fork 157
Generate cnats-config-version.cmake #813
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
Conversation
…ion in find_package
CMakeLists.txt
Outdated
|
|
||
| write_basic_package_version_file( | ||
| "${PROJECT_BINARY_DIR}/cnats-config-version.cmake" | ||
| COMPATIBILITY SameMajorVersion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rolflussi I do not have much personal experience with cmake package management/discovery, but what I understood from https://cmake.org/cmake/help/latest/module/CMakePackageConfigHelpers.html#generating-a-package-version-file, I think we should be using SameMinorVersion if binary compatibility is desired. Furthermore, binary compatibility may be broken even in patch releases (thus, NATS_VERSION_REQUIRED_NUMBER check), I am not sure what the best practice on this is.
@kozlovic do you have an opinion on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we do (or should) break compatibility in a patch release. But yes, minor release may introduce new APIs, etc.. that may cause their local header file to not be in phase with the linked library (this is why we have some API to check for compatibility between the header and the lib's version).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your feedback. I'll change it to SameMinorVersion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I misspoke re: patch releases; I was thinking a hypothetical emergency patch that'd break the memory layout, but we'd just release it as a X.Y+1.0 from the X.Y branch.
levb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* provide cnats-config-version.cmake to be able to define required version in find_package * change from requiring same major version to same minor version --------- Co-authored-by: Rolf Lussi <[email protected]>
|
Cherry-picked into v3.9.2 |
Implementation of #812
Allows other cmake projects to use this library with a specific version:
The cnats-config-version.cmake will make sure that the correct major version and at least the defined minor version is available.