Skip to content

Commit

Permalink
meson: Use git version only if git exists
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrd committed May 11, 2020
1 parent 23d9acb commit 040ff0d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ deps = [

# alternative to vcs_tag that allows reuse of version
# see https://github.com/mesonbuild/meson/issues/3903
r = run_command('git', 'describe', '--dirty', '--tags', '--always')
if r.returncode() == 0
version = r.stdout().strip()
else
version = meson.project_version()
version = meson.project_version()
git = find_program('git', required : false)
if git.found()
r = run_command('git', 'describe', '--dirty', '--tags', '--always')
if r.returncode() == 0
version = r.stdout().strip()
endif
endif

add_project_arguments('-DVERSION="@0@"'.format(version), language : 'c')
Expand Down

0 comments on commit 040ff0d

Please sign in to comment.