diff options
author | troyengel <troyengel@gmail.com> | 2015-11-09 19:51:32 -0600 |
---|---|---|
committer | troyengel <troyengel@gmail.com> | 2015-11-09 19:51:32 -0600 |
commit | 9078ecb650220755589d100174ab5b7e34da6b01 (patch) | |
tree | 25e7ff7b95f6856696d233eee42e95a2c3388fdf /cmake | |
parent | 83f29d844ca3d63a7921d65bf3baf4989f8850f9 (diff) | |
download | bcc-9078ecb650220755589d100174ab5b7e34da6b01.tar.gz |
Fixes #285 - build process assumes git use
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/version.cmake | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/cmake/version.cmake b/cmake/version.cmake index 14551616..fb00408a 100644 --- a/cmake/version.cmake +++ b/cmake/version.cmake @@ -1,11 +1,11 @@ # Copyright (c) PLUMgrid, Inc. # Licensed under the Apache License, Version 2.0 (the "License") -get_git_head_revision(GIT_REFSPEC GIT_SHA1) -string(SUBSTRING "${GIT_SHA1}" 0 8 GIT_SHA1_SHORT) -git_describe(GIT_DESCRIPTION) -git_describe(GIT_TAG_LAST "--abbrev=0") -git_get_exact_tag(GIT_TAG_EXACT) if(NOT REVISION) + get_git_head_revision(GIT_REFSPEC GIT_SHA1) + string(SUBSTRING "${GIT_SHA1}" 0 8 GIT_SHA1_SHORT) + git_describe(GIT_DESCRIPTION) + git_describe(GIT_TAG_LAST "--abbrev=0") + git_get_exact_tag(GIT_TAG_EXACT) string(SUBSTRING "${GIT_TAG_LAST}-${GIT_SHA1_SHORT}" 1 -1 REVISION) if(GIT_TAG_EXACT) string(SUBSTRING "${GIT_TAG_EXACT}" 1 -1 REVISION) @@ -15,11 +15,13 @@ if(NOT REVISION) set(GIT_TAG_EXACT "") endif() message(STATUS "Git HEAD is ${GIT_SHA1}") + # rpm/deb packaging uses this, only works on whole tag numbers + if(NOT REVISION_LAST) + string(SUBSTRING "${GIT_TAG_LAST}" 1 -1 REVISION_LAST) + endif() +else() + set(REVISION_LAST "${REVISION}") endif() # strip leading 'v', and make unique for the tag message(STATUS "Revision is ${REVISION}") -# rpm/deb packaging uses this, only works on whole tag numbers -if(NOT REVISION_LAST) - string(SUBSTRING "${GIT_TAG_LAST}" 1 -1 REVISION_LAST) -endif() |