Allow to retrieve extended version information at runtime #130
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.
I've added a function (
bitpit::getVersion()
) that allows to retrieve version information at runtime. The version string contains the bitpit version plus additional information about git branch/commit. For example the version string may be like the following:where:
1.8.0
is the "standard" bitpit versionadd.git.info.to.version
is the current branchde4aebf84
is the current commitdirty
is a (configurable) label that tells if the current source has uncommitted changes.I haven't found a way to automatically re-run cmake (and thus update the version) if there are uncommitted changes. The "dirty" label will be reliably added only if, after changing the code, cmake is run manually.
Git information will be added only if the current HEAD is not associated with a tag in the form "bitpit-X.Y.Z" where "X.Y.Z" should match the version number. In this way git information will be shown only for development builds.