mirror of https://github.com/CGAL/cgal
Add the piece of CMake code to detect the URL of the current SVN branch
(Still to-do for Git...)
This commit is contained in:
parent
f180a09d55
commit
771760b538
|
|
@ -22,9 +22,22 @@ if ( ${CGAL_SCM_NAME} STREQUAL "svn" )
|
||||||
|
|
||||||
find_program(SVN_EXECUTABLE svn DOC "subversion command line client")
|
find_program(SVN_EXECUTABLE svn DOC "subversion command line client")
|
||||||
|
|
||||||
# TODO detect name
|
function(Subversion_GET_URL dir variable)
|
||||||
set ( CGAL_SCM_BRANCH_NAME "n/a" )
|
# use svnversion
|
||||||
|
execute_process(COMMAND "${SVN_EXECUTABLE}" info --xml "${dir}"
|
||||||
|
OUTPUT_VARIABLE ${variable}
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
string(REGEX REPLACE ".*<url>([^<]+)</url>.*" "\\1" ${variable} "${${variable}}")
|
||||||
|
if(NOT variable)
|
||||||
|
message("Warning: can not get the Subversion URL of directory ${dir}")
|
||||||
|
endif()
|
||||||
|
set(${variable} ${${variable}} PARENT_SCOPE)
|
||||||
|
endfunction(Subversion_GET_URL)
|
||||||
|
|
||||||
|
Subversion_GET_URL("${CGAL_INSTALLATION_PACKAGE_DIR}" CGAL_INSTALLATION_SVN_URL)
|
||||||
|
string(REGEX REPLACE "(.*)/Installation" "\\1" CGAL_TMP_SVN_BRANCH_NAME "${CGAL_INSTALLATION_SVN_URL}")
|
||||||
|
|
||||||
|
set ( CGAL_SCM_BRANCH_NAME "${CGAL_TMP_SVN_BRANCH_NAME}" )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if ( ${CGAL_SCM_NAME} STREQUAL "git" )
|
if ( ${CGAL_SCM_NAME} STREQUAL "git" )
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,9 @@ if ( CGAL_BRANCH_BUILD )
|
||||||
OUTPUT_VARIABLE ${variable}
|
OUTPUT_VARIABLE ${variable}
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
string(REGEX REPLACE "^(.*\n)? revision=\"([^\n]+)\".*url.*" "\\2" ${variable} "${${variable}}")
|
string(REGEX REPLACE "^(.*\n)? revision=\"([^\n]+)\".*url.*" "\\2" ${variable} "${${variable}}")
|
||||||
|
if(NOT variable)
|
||||||
|
message("Warning: can not get the Subversion revision of directory ${dir}")
|
||||||
|
endif()
|
||||||
set(${variable} ${${variable}} PARENT_SCOPE)
|
set(${variable} ${${variable}} PARENT_SCOPE)
|
||||||
endfunction(Subversion_GET_REVISION)
|
endfunction(Subversion_GET_REVISION)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue