From 2de1f4cb59e0b34800967e0d6772d854ee9c42a5 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Thu, 14 Jan 2016 22:44:29 +0000 Subject: [PATCH] [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. llvm-svn: 257826 --- cmake/modules/VersionFromVCS.cmake | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cmake/modules/VersionFromVCS.cmake b/cmake/modules/VersionFromVCS.cmake index 26314d4126d..85cb8ead21a 100644 --- a/cmake/modules/VersionFromVCS.cmake +++ b/cmake/modules/VersionFromVCS.cmake @@ -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()