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,6 +6,10 @@ if( NOT CGAL_SCM_FILE_INCLUDED )
|
||||||
|
|
||||||
set(GIT_PARENT_DIR "${CMAKE_SOURCE_DIR}")
|
set(GIT_PARENT_DIR "${CMAKE_SOURCE_DIR}")
|
||||||
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
|
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
|
||||||
|
#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
|
while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
|
||||||
set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
|
set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
|
||||||
get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
|
get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
|
||||||
|
|
@ -22,10 +26,12 @@ while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
|
||||||
set( CGAL_SCM_NAME "git" )
|
set( CGAL_SCM_NAME "git" )
|
||||||
endif()
|
endif()
|
||||||
endwhile()
|
endwhile()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#message ("====GPD1: ${GIT_PARENT_DIR}")
|
||||||
|
|
||||||
if ( "${CGAL_SCM_NAME}" STREQUAL "git" )
|
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")
|
find_program(GIT_EXECUTABLE git DOC "git command line client")
|
||||||
EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} --git-dir=${GIT_PARENT_DIR}/.git symbolic-ref HEAD
|
EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} --git-dir=${GIT_PARENT_DIR}/.git symbolic-ref HEAD
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue