Skip to content

Commit

Permalink
De-duplicate git version string deduction into one new tool
Browse files Browse the repository at this point in the history
  • Loading branch information
LebedevRI committed Feb 25, 2016
1 parent dc2dfcd commit 7fbddea
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ else(DEFINED PROJECT_VERSION)
if(NOT SOURCE_PACKAGE) # i.e., a git checkout
# this part is setting the corresponding CMake variable which gets used for example when creating a source package
execute_process(
COMMAND git describe --tags --dirty
COMMAND sed "s,^release-,,;s,-,+,;s,-,~,;" OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE PROJECT_VERSION
COMMAND ${CMAKE_SOURCE_DIR}/tools/get_git_version_string.sh OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE PROJECT_VERSION
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
generate_version_gen_h()
else(NOT SOURCE_PACKAGE)
Expand Down
2 changes: 1 addition & 1 deletion tools/create_version_h.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ NEW_VERSION=$2

VERSION_H_NEEDS_UPDATE=1
if [ -z "$NEW_VERSION" ]; then
NEW_VERSION=`git describe --tags --dirty | sed 's,^release-,,;s,-,+,;s,-,~,;'`
NEW_VERSION=`./tools/get_git_version_string.sh`
fi

if [ -n "`echo -e $NEW_VERSION | grep Format`" ]; then
Expand Down
5 changes: 5 additions & 0 deletions tools/get_git_version_string.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

set -e

git describe --tags --dirty | sed 's,^release-,,;s,-,+,;s,-,~,;'

0 comments on commit 7fbddea

Please sign in to comment.