Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes issue with versioning stuck at 1.4.0 for version cloned with git. #762

Merged
merged 1 commit into from
Jan 24, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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