1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

[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
This commit is contained in:
Chris Bieneman 2016-01-14 22:44:29 +00:00
parent 13b300b864
commit 2de1f4cb59

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()