[CMake] Add support for populating LLVM_REPOSITORY from CMake.

Autoconf does this in the GetRepositoryPath script, CMake's VersionFromVCS does grab the SVN_REVISION, but doesn't populate the repository URL.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257826 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Bieneman 2016-01-14 22:44:29 +00:00
parent 508bcbefca
commit 92f6aec271

View File

@ -16,6 +16,9 @@ function(add_version_info_from_vcs VERS)
set(SVN_REVISION ${Project_WC_REVISION} PARENT_SCOPE)
set(result "${result}-r${Project_WC_REVISION}")
endif()
if( Project_WC_URL )
set(LLVM_REPOSITORY ${Project_WC_URL} PARENT_SCOPE)
endif()
endif()
elseif( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git )
set(result "${result}git")
@ -65,6 +68,19 @@ function(add_version_info_from_vcs VERS)
else()
set(result "${result}${git_svn_rev}")
endif()
execute_process(COMMAND
${git_executable} svn info
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
TIMEOUT 5
RESULT_VARIABLE git_result
OUTPUT_VARIABLE git_output)
if( git_result EQUAL 0)
string(REGEX MATCH "URL: ([^ \n]*)" svn_url ${git_output})
if(svn_url)
set(LLVM_REPOSITORY ${CMAKE_MATCH_1} PARENT_SCOPE)
endif()
endif()
endif()
endif()
endif()