[llvm] r257826 - [CMake] Add support for populating LLVM_REPOSITORY from CMake.

Chris Bieneman via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 14 14:44:33 PST 2016


Author: cbieneman
Date: Thu Jan 14 16:44:29 2016
New Revision: 257826

URL: http://llvm.org/viewvc/llvm-project?rev=257826&view=rev
Log:
[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.

Modified:
    llvm/trunk/cmake/modules/VersionFromVCS.cmake

Modified: llvm/trunk/cmake/modules/VersionFromVCS.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/VersionFromVCS.cmake?rev=257826&r1=257825&r2=257826&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/VersionFromVCS.cmake (original)
+++ llvm/trunk/cmake/modules/VersionFromVCS.cmake Thu Jan 14 16:44:29 2016
@@ -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()




More information about the llvm-commits mailing list