-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update release string logic to check for git dir by default
- Loading branch information
Showing
2 changed files
with
29 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
set(LATEST_RELEASE "2017-03-R2") | ||
|
||
execute_process( | ||
COMMAND git log -n 1 --format=%h | ||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} | ||
RESULT_VARIABLE GIT_EXIT_ERROR | ||
ERROR_QUIET | ||
OUTPUT_VARIABLE GIT_VERSION | ||
OUTPUT_STRIP_TRAILING_WHITESPACE | ||
) | ||
if (GIT_EXIT_ERROR) | ||
# We're probably not in a git repo | ||
set(RELEASE ${LATEST_RELEASE}) | ||
else (GIT_EXIT_ERROR) | ||
# We're in a git repo | ||
execute_process( | ||
COMMAND git status -s --untracked-files=no | ||
OUTPUT_VARIABLE DIRTY | ||
) | ||
if ( NOT "${DIRTY}" STREQUAL "" ) | ||
set(DIRTY_FLAG "*") | ||
else() | ||
set(DIRTY_FLAG "") | ||
endif() | ||
set(RELEASE "git-${GIT_VERSION}${DIRTY_FLAG}") | ||
endif (GIT_EXIT_ERROR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters