[SWDEV-493519] Fix Getting Version Information (#201)

Signed-off-by: Joseph Narlo <joseph.narlo@amd.com>
This commit is contained in:
Narlo, Joseph
2025-03-28 11:12:21 -05:00
committed by GitHub
parent edf70ea81a
commit df8ee3db85
2 changed files with 9 additions and 5 deletions
+4 -1
View File
@@ -64,11 +64,14 @@ function(get_version_from_tag DEFAULT_VERSION_STRING VERSION_PREFIX GIT)
parse_version ( ${DEFAULT_VERSION_STRING} )
if ( GIT )
execute_process ( COMMAND git describe --tags --dirty --long --match ${VERSION_PREFIX}-[0-9.]*
execute_process ( COMMAND git tag --list --sort=-version:refname "${VERSION_PREFIX}*" | head -n 1 ${VERSION_PREFIX}-[0-9.]*
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_TAG_STRING
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE RESULT )
if ( GIT_TAG_STRING STREQUAL "" )
set ( RESULT "1" )
endif()
if ( ${RESULT} EQUAL 0 )
parse_version ( ${GIT_TAG_STRING} )
endif ()