mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
CMake: Force use of project directory to look for Git data.
Before this change, building Neovim would recursively search parent directories for a .git directory. If Neovim was downloaded as a tarball (i.e. without a .git directory), but placed in a subdirectory of a Git repository, this caused a CMake error. Such a situation could occur when packaging Neovim, for example. Unfortunately, the previous attempt in #3317 did not fix this problem.
This commit is contained in:
parent
a83020922d
commit
90909e9362
@ -52,8 +52,8 @@ set(NVIM_VERSION_MINOR 0)
|
||||
set(NVIM_VERSION_PATCH 0)
|
||||
set(NVIM_VERSION_PRERELEASE "-alpha")
|
||||
|
||||
file(TO_CMAKE_PATH ${CMAKE_CURRENT_LIST_DIR}/.git FORCED_GIT_DIR)
|
||||
include(GetGitRevisionDescription)
|
||||
file(TO_NATIVE_PATH ${CMAKE_CURRENT_LIST_DIR}/.git GIT_DIR)
|
||||
if(NVIM_VERSION_PRERELEASE)
|
||||
get_git_head_revision(GIT_REFSPEC NVIM_VERSION_COMMIT)
|
||||
|
||||
|
@ -42,7 +42,13 @@ set(__get_git_revision_description YES)
|
||||
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||
|
||||
function(get_git_dir _gitdir)
|
||||
# check GIT_DIR in environment first
|
||||
# check FORCED_GIT_DIR first
|
||||
if(FORCED_GIT_DIR)
|
||||
set(${_gitdir} ${FORCED_GIT_DIR} PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# check GIT_DIR in environment
|
||||
set(GIT_DIR $ENV{GIT_DIR})
|
||||
if(NOT GIT_DIR)
|
||||
set(GIT_PARENT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
Loading…
Reference in New Issue
Block a user