mirror of https://github.com/CGAL/cgal
fix if git dir is already given dir
This commit is contained in:
parent
7937e731d8
commit
ddd4ca95da
|
|
@ -6,7 +6,11 @@ if( NOT CGAL_SCM_FILE_INCLUDED )
|
|||
|
||||
set(GIT_PARENT_DIR "${CMAKE_SOURCE_DIR}")
|
||||
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
|
||||
while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
|
||||
#message ("-----GD: ${GIT_DIR}")
|
||||
if (EXISTS "${GIT_DIR}")
|
||||
set( CGAL_SCM_NAME "git" )
|
||||
else()
|
||||
while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
|
||||
set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
|
||||
get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
|
||||
#message ("-----GPD1: ${GIT_PARENT_DIR}")
|
||||
|
|
@ -21,11 +25,13 @@ while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
|
|||
set( GIT_DIR "${GIT_PARENT_DIR}/.git" )
|
||||
set( CGAL_SCM_NAME "git" )
|
||||
endif()
|
||||
endwhile()
|
||||
endwhile()
|
||||
endif()
|
||||
|
||||
#message ("====GPD1: ${GIT_PARENT_DIR}")
|
||||
|
||||
if ( "${CGAL_SCM_NAME}" STREQUAL "git" )
|
||||
#message ("====GPD: ${GIT_PARENT_DIR}")
|
||||
#message ("====GPD2: ${GIT_PARENT_DIR}")
|
||||
|
||||
find_program(GIT_EXECUTABLE git DOC "git command line client")
|
||||
EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} --git-dir=${GIT_PARENT_DIR}/.git symbolic-ref HEAD
|
||||
|
|
|
|||
Loading…
Reference in New Issue