build: restrict git describe to top level source directory (#20993)

fix version determination when building neovim from release tarball
extracted within another git repository
This commit is contained in:
Jan Palus 2022-12-02 13:45:37 +01:00 committed by GitHub
parent c95a0c9959
commit a3f01d32cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -2,7 +2,7 @@ set(NVIM_VERSION
"v${NVIM_VERSION_MAJOR}.${NVIM_VERSION_MINOR}.${NVIM_VERSION_PATCH}${NVIM_VERSION_PRERELEASE}")
execute_process(
COMMAND git describe --first-parent --dirty --always
COMMAND git --git-dir=${NVIM_SOURCE_DIR}/.git --work-tree=${NVIM_SOURCE_DIR} describe --first-parent --dirty --always
OUTPUT_VARIABLE GIT_TAG
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE RES)

View File

@ -206,6 +206,7 @@ add_custom_target(update_version_stamp
-DNVIM_VERSION_PATCH=${NVIM_VERSION_PATCH}
-DNVIM_VERSION_PRERELEASE=${NVIM_VERSION_PRERELEASE}
-DOUTPUT=${NVIM_VERSION_GIT_H}
-DNVIM_SOURCE_DIR=${CMAKE_SOURCE_DIR}
-P ${PROJECT_SOURCE_DIR}/cmake/GenerateVersion.cmake
BYPRODUCTS ${NVIM_VERSION_GIT_H})