diff --git a/CMakeModules/GenerateSCMRev.cmake b/CMakeModules/GenerateSCMRev.cmake index 3f5ce0f34..a568e4ea3 100644 --- a/CMakeModules/GenerateSCMRev.cmake +++ b/CMakeModules/GenerateSCMRev.cmake @@ -53,4 +53,11 @@ if (BUILD_REPOSITORY) endif() endif() +# Add a fallback for local builds +# If BUILD_VERSION is still "0", it means the CI-specific logic was not executed. +# In that case, we should use the git description which contains the commit hash. +if (BUILD_VERSION STREQUAL "0") + set(BUILD_VERSION ${GIT_DESC}) +endif() + configure_file(scm_rev.cpp.in scm_rev.cpp @ONLY)