Skip to content

Commit

Permalink
This fixes the versioning when compiling from the repo checked out wi…
Browse files Browse the repository at this point in the history
…th git. (#762)
  • Loading branch information
Tcenova authored and xor-gate committed Jan 24, 2019
1 parent 0f1fc50 commit af325bb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmake/Version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if (GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
# Working off a git repo, using git versioning
# Check if HEAD is pointing to a tag
execute_process (
COMMAND "${GIT_EXECUTABLE}" describe --always
COMMAND "${GIT_EXECUTABLE}" describe --always --tag
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
OUTPUT_VARIABLE PROJECT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
Expand All @@ -21,6 +21,9 @@ if (GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
set (PROJECT_VERSION "${PROJECT_VERSION}-dirty")
endif()

# strip a leading v off of the version as proceeding code expectes just the version numbering.
string(REGEX REPLACE "^v" "" PROJECT_VERSION ${PROJECT_VERSION})

string(REGEX REPLACE "^(0|[1-9][0-9]*)[.](0|[1-9][0-9]*)[.](0|[1-9][0-9]*)(-[.0-9A-Za-z-]+)?([+][.0-9A-Za-z-]+)?$"
"\\1;\\2;\\3" PROJECT_VERSION_LIST ${PROJECT_VERSION})
list(LENGTH PROJECT_VERSION_LIST len)
Expand Down

0 comments on commit af325bb

Please sign in to comment.