Skip to content

Obtain a version automatically #29

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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Patater
Copy link
Contributor

@Patater Patater commented May 26, 2021

Attempt to determine a version automatically using git. Fallback to
v0.0.0 if the version can't be determined (e.g. due to git error, or if
the library is not from a git repo).

This makes it easier to tag-to-release as we don't have to edit a file
at the same time we make a tag: no repository contents need change when
making a release.

Patater added 2 commits May 26, 2021 15:39
With this macro, and version, checked into the repo, it also makes it
hard to acheive the ideal of "tag to release" (because the contents of
the repo would have to change at the same time as tagging). Mbed OS
didn't use this macro. Given the macro is likely unused, and we only use
it internally to share with the host what client version is running,
remove the version macro from the public API.
Attempt to determine a version automatically using git. Fallback to
v0.0.0 if the version can't be determined (e.g. due to git error, or if
the library is not from a git repo).

This makes it easier to tag-to-release as we don't have to edit a file
at the same time we make a tag: no repository contents need change when
making a release.
@Patater
Copy link
Contributor Author

Patater commented May 26, 2021

This probably doesn't work very well for find_package().

@Patater Patater marked this pull request as draft May 26, 2021 15:06
@rwalton-arm
Copy link
Contributor

rwalton-arm commented Jun 9, 2021

This probably doesn't work very well for find_package().

This should be OK with find_package, the version will be written to the package version file at export/install time. The only thing is you would need to run your CMake configure and CMake install commands from the repo so git describe works. We could probably add a test to the CI workflow to make sure the find_package stuff works as we expect.

@Patater
Copy link
Contributor Author

Patater commented Jun 9, 2021

Interesting, I'll need to add a commit to add some find_package() testing to this PR and see how well it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants