Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Commit 658c286

Browse files
committed
CPack: fallback to v0.0.0-0 when git describe fails
When doing a shallow clone, the git repository may not have fetched any tag - in which case `git describe --tags` will fail and in turn, cpack/CMakeLists.txt will raise an error. This makes current CI builds fail. As a temporary workaround, fallback to v0.0.0-0. Signed-off-by: David Wagner <[email protected]>
1 parent bc6be35 commit 658c286

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cpack/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ execute_process(COMMAND git describe --tags --long
3434

3535
set(REGEX "^v([0-9]+)\\.([0-9]+)\\.([0-9]+)-([0-9]+).*$")
3636
if(NOT "${GIT_DESCRIBE}" MATCHES "${REGEX}")
37-
MESSAGE(SEND_ERROR "Could not parse git describe version \"${GIT_DESCRIBE}\" "
38-
"with regex \"${REGEX}\"")
37+
message(WARNING "Could not parse git describe version \"${GIT_DESCRIBE}\" "
38+
"with regex \"${REGEX}\". Falling back to 'v0.0.0-0'")
39+
set(GIT_DESCRIBE "v0.0.0-0")
3940
endif()
4041
string(REGEX REPLACE "${REGEX}" "\\1" CPACK_PACKAGE_VERSION_MAJOR "${GIT_DESCRIBE}")
4142
string(REGEX REPLACE "${REGEX}" "\\2" CPACK_PACKAGE_VERSION_MINOR "${GIT_DESCRIBE}")

0 commit comments

Comments
 (0)