Add cpp_library_set_version for git-based versioning#18
Merged
sean-parent merged 2 commits intomainfrom Dec 19, 2025
Merged
Conversation
Introduces the cpp_library_set_version() function to set project version variables from git tags after project() is called, enabling git-based versioning for custom setups. Updates documentation with usage instructions and refactors cpp_library_setup() to use the new function for version management.
Adds backward compatibility by setting PROJECT_VERSION and its components (MAJOR, MINOR, PATCH) in the parent scope within cpp_library_setup.
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.
Introduces the cpp_library_set_version() function to set project version variables from git tags after project() is called, enabling git-based versioning for custom setups. Updates documentation with usage instructions and refactors cpp_library_setup() to use the new function for version management.
Note
Adds cpp_library_set_version for git tag-based project versioning and updates cpp_library_setup to use it; documents usage in README.
cpp_library_set_version()to setPROJECT_VERSION*from git tags (respectsCPP_LIBRARY_VERSION, stripsvprefix, falls back to0.0.0).cpp_library_setup()now callscpp_library_set_version()and propagatesPROJECT_VERSION*instead of duplicating parsing logic.cpp_library_set_version()inREADME.md(including stlab example and when-to-use notes).Written by Cursor Bugbot for commit 49cd94f. This will update automatically on new commits. Configure here.