fix if git dir is already given dir

This commit is contained in:
Eric Berberich 2012-11-13 16:20:07 +01:00
parent 7937e731d8
commit ddd4ca95da
1 changed files with 23 additions and 17 deletions

View File

@ -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