From d3bb3a1605bf73e623b338f08ed0cd1c13419891 Mon Sep 17 00:00:00 2001 From: Daljit Singh Date: Wed, 18 Sep 2024 08:06:58 +0100 Subject: [PATCH] Fix git version mismatch logic with shallow clones --- cmake/FindVersion.cmake | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cmake/FindVersion.cmake b/cmake/FindVersion.cmake index dad95c6a0c..4568ce1ef7 100644 --- a/cmake/FindVersion.cmake +++ b/cmake/FindVersion.cmake @@ -20,15 +20,14 @@ if(EXISTS ${ROOT_DIR}/.git) OUTPUT_STRIP_TRAILING_WHITESPACE ) - if(NOT "${MRTRIX_GIT_TAG}" STREQUAL ${MRTRIX_BASE_VERSION}) - message(FATAL_ERROR "MRtrix3 base version does not match the git tag!") - endif() - if(NOT MRTRIX_GIT_TAG_ERROR AND NOT MRTRIX_GIT_COMMIT_ERROR) message(VERBOSE "Git tag: ${MRTRIX_GIT_TAG}; Git commit: ${MRTRIX_GIT_COMMIT}") + if(NOT "${MRTRIX_GIT_TAG}" STREQUAL ${MRTRIX_BASE_VERSION}) + message(FATAL_ERROR "MRtrix3 base version does not match the git tag!") + endif() set(MRTRIX_VERSION ${MRTRIX_GIT_COMMIT}) else() - message(WARNING "Git tag: not found.") + message(WARNING "Failed to get git tag and commit. Version will be set to default base version.") endif() else() message(WARNING "Git not found on this system. Version will be set to default base version.")