diff options
author | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2022-09-10 14:37:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-10 14:37:11 +0200 |
commit | 2a1c65b330c1cf65207cdd992529ad3bb1a197a4 (patch) | |
tree | 862af8f64adb078aada436f69038b98dbbc5e42e | |
parent | 4638fcf4fb688fa548b8ce337ec3b7c1327fbfe9 (diff) | |
download | rneovim-2a1c65b330c1cf65207cdd992529ad3bb1a197a4.tar.gz rneovim-2a1c65b330c1cf65207cdd992529ad3bb1a197a4.tar.bz2 rneovim-2a1c65b330c1cf65207cdd992529ad3bb1a197a4.zip |
build: ensure version generation always succeeds (#19515)
Add --always flag to `git describe` so version generation succeeds if
current directory is in a git repo. If not in git repo, fall back to a
default version in the format vx.y.z-dev
-rw-r--r-- | cmake/GenerateVersion.cmake | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/cmake/GenerateVersion.cmake b/cmake/GenerateVersion.cmake index 6118d8cba7..a7a72fe0bb 100644 --- a/cmake/GenerateVersion.cmake +++ b/cmake/GenerateVersion.cmake @@ -7,15 +7,11 @@ set(NVIM_VERSION_MEDIUM "v${NVIM_VERSION_MAJOR}.${NVIM_VERSION_MINOR}.${NVIM_VERSION_PATCH}${NVIM_VERSION_PRERELEASE}") execute_process( - COMMAND git describe --first-parent --dirty + COMMAND git describe --first-parent --dirty --always OUTPUT_VARIABLE GIT_TAG - ERROR_VARIABLE ERR - RESULT_VARIABLE RES -) + RESULT_VARIABLE RES) -if(NOT RES EQUAL 0) - message(STATUS "Git tag extraction failed:\n" " ${GIT_TAG}${ERR}" ) - # This will only be executed once since the file will get generated afterwards. +if(RES AND NOT RES EQUAL 0) message(STATUS "Using NVIM_VERSION_MEDIUM: ${NVIM_VERSION_MEDIUM}") file(WRITE "${OUTPUT}" "${NVIM_VERSION_STRING}") return() |