-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the git commit hash as the version if not on a tag (#56)
- Loading branch information
1 parent
8c0bf3e
commit 93129ff
Showing
2 changed files
with
10 additions
and
3 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 |
---|---|---|
@@ -1 +1 @@ | ||
const char* version = "@GIT_TAG@"; | ||
const char* version = "@GIT_REF@"; |
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 |
---|---|---|
@@ -1,7 +1,14 @@ | ||
execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --dirty --match "v*" | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} | ||
OUTPUT_VARIABLE GIT_TAG | ||
OUTPUT_VARIABLE GIT_REF | ||
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) | ||
|
||
configure_file(${SRC} ${DST} @ONLY) | ||
# If we're not on a tag, use the commit hash | ||
if(NOT GIT_REF) | ||
execute_process(COMMAND ${GIT_EXECUTABLE} describe --always --dirty | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} | ||
OUTPUT_VARIABLE GIT_REF | ||
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) | ||
endif() | ||
|
||
configure_file(${SRC} ${DST} @ONLY) |