Repository navigation
build(cmake): accept only the same minor version in the package config - #253
Merged
Merged
Conversation
With SameMajorVersion and major version 0, find_package(rabitqlib 0.8) accepted any 0.x release, including a 0.9 that breaks the API. The package version file now uses SameMinorVersion. A new CTest, PackageVersionCompatibility, includes the generated version file and checks that the same major.minor is accepted and an older minor or major is rejected. The C++ integration guide explains version requests and ranges.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
write_basic_package_version_fileusedSameMajorVersion. With major version 0 that madefind_package(rabitqlib 0.8)accept every 0.x release, including 0.9, which breaks the C++ index API. The package version file now usesSameMinorVersion: a request forX.Y[.Z]is satisfied only byX.Y.zwithz >= Z, and a version range must stay within one minor release, such as0.9...<0.10.CMakeLists.txt:COMPATIBILITY SameMinorVersion, with a comment on why.PackageVersionCompatibility(tests/core_consumer/check_package_version.cmake): includes the generatedrabitqlibConfigVersion.cmakewith the variablesfind_packagesets and checks thatX.YandX.Y.0are accepted and the previous minor and previous major are rejected. Registered for every test build, including core-only builds; no install needed.docs/docs/cpp_integration.md: how to request a version and a range. Release notes: one line under C++ changes.No file in the repository passes a version to
find_package(rabitqlib ...). Consumers that add the library withadd_subdirectorydo not read the version file.Found during a pre-release check of
dev/0.9.Testing
Local, Linux x86-64, CMake 3.28:
ctest -R PackageVersionCompatibilitypasses.SameMinorVersionat all five; fails forSameMajorVersionat 0.8.5, 0.9.0 and 1.2.3 and forAnyNewerVersionat 0.8.5, 0.9.0, 1.0.0 and 1.2.3. At X.0.z the modes cannot be told apart by an older request.find_package: no version, 0.8, 0.8.0 and 0.8.5 are found; 0.8.6, 0.7, 0.9 and 1.0 are rejected (0.7 was found before this change). Ranges:0.8...<0.9is found,0.8...0.9is rejected.mkdocs build --strict,git diff --check.