-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add version info to cucumber-cpp-main
- Loading branch information
1 parent
ddc4bd6
commit 8a0d16b
Showing
3 changed files
with
42 additions
and
0 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,29 @@ | ||
function(git_get_version VERSION_VARIABLE) | ||
find_program(GIT_EXECUTABLE git) | ||
|
||
if(NOT GIT_EXECUTABLE) | ||
message(FATAL_ERROR "Git not found. Please install Git and make sure it is in your system's PATH.") | ||
endif() | ||
|
||
execute_process( | ||
COMMAND ${GIT_EXECUTABLE} describe --always --dirty | ||
OUTPUT_VARIABLE VERSION_STRING | ||
OUTPUT_STRIP_TRAILING_WHITESPACE | ||
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" | ||
ERROR_VARIABLE GIT_DESCRIBE_ERROR | ||
RESULT_VARIABLE GIT_DESCRIBE_RESULT | ||
) | ||
|
||
if(NOT GIT_DESCRIBE_RESULT EQUAL 0) | ||
message(FATAL_ERROR "Error running 'git describe': ${GIT_DESCRIBE_ERROR}") | ||
endif() | ||
|
||
string(LENGTH "${VERSION_STRING}" VERSION_STRING_LENGTH) | ||
string(SUBSTRING "${VERSION_STRING}" 0 1 FIRST_CHARACTER) | ||
|
||
if("${FIRST_CHARACTER}" STREQUAL "v") | ||
string(SUBSTRING "${VERSION_STRING}" 1 ${VERSION_STRING_LENGTH} VERSION_STRING) | ||
endif() | ||
|
||
set(${VERSION_VARIABLE} ${VERSION_STRING} PARENT_SCOPE) | ||
endfunction() |
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
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