diff options
author | Patrick Steinhardt <ps@pks.im> | 2020-06-05 10:07:33 +0200 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2020-07-12 14:45:47 +0200 |
commit | 19eb1e4bb740d72ebaddc9eb5084d8e013c68ddc (patch) | |
tree | cc628e05112640f5c15ae826fec2da88ce19b91d /script | |
parent | 325375e3b6c2c31152b7ee48794aa6a1f73709d5 (diff) | |
download | libgit2-19eb1e4bb740d72ebaddc9eb5084d8e013c68ddc.tar.gz |
cmake: specify project version
We currently do not set up a project version within CMake, meaning that
it can't be use by other projects including libgit2 as a sub-project and
also not by other tools like IDEs.
This commit changes this to always set up a project version, but instead
of extracting it from the "version.h" header we now set it up directly.
This is mostly to avoid mis-use of the previous `LIBGIT2_VERSION`
variables, as we should now always use the `libgit2_VERSION` ones that
are set up by CMake if one provides the "VERSION" keyword to the
`project()` call. While this is one more moving target we need to adjust
on releases, this commit also adjusts our release script to verify that
the project version was incremented as expected.
Diffstat (limited to 'script')
-rwxr-xr-x | script/release.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/script/release.py b/script/release.py index 99ff8ecaf..1a240deca 100755 --- a/script/release.py +++ b/script/release.py @@ -40,6 +40,15 @@ def verify_version(version): 'SOVERSION': [ '"{}.{}"'.format(version.major, version.minor), None ], } + # Parse CMakeLists + with open('CMakeLists.txt') as f: + for line in f.readlines(): + if line.startswith('project(libgit2 VERSION "{}"'.format(version)): + break + else: + raise Error("cmake: invalid project definition") + + # Parse version.h with open('include/git2/version.h') as f: lines = f.readlines() |