+ _set_untagged_commit_flag(${VERSION_EXTRA})
+
+ if(${IS_UNTAGGED_COMMIT})
+ _increment_patch_and_strip_package_release(${VERSION_PATCH} ${VERSION_EXTRA})
+ endif()
+
+ set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}-${VERSION_EXTRA}")
+
+ if(DEFINED BUILD_METADATA)
+ set(VERSION "${VERSION}+${BUILD_METADATA}")
+ endif()
+
+ if(NOT "${VERSION}" MATCHES
+ "^[0-9]+\\.[0-9]+\\.[0-9]+-(([0-9a-zA-Z]+)|(r[0-9]+\\.g[0-9a-zA-Z]+))(\\+[0-9a-zA-Z]+)?$")
+
+ message(FATAL_ERROR
+ "\nCOULD NOT EXTRACT VALID VERSION STRING FROM git_describe!"
+ "\n git_describe returned: \"${GIT_DESCRIPTION}\""
+ "\n Extracted invalid version string: \"${VERSION}\"\n")
+ endif()
+
+ set(${_gitversionprefix} "${VERSION}" PARENT_SCOPE)