From 418e54b4016434df1392a825f76e20b72f615ff3 Mon Sep 17 00:00:00 2001 From: Axel Isouard Date: Sun, 19 Mar 2017 19:52:34 +0100 Subject: [PATCH] Execute checkout commands inside the main CMake file --- CMakeModules/DepotTools.cmake | 29 +------------------------ webrtc/CMakeLists.txt.in | 40 +++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 28 deletions(-) diff --git a/CMakeModules/DepotTools.cmake b/CMakeModules/DepotTools.cmake index 238b650..90a8254 100644 --- a/CMakeModules/DepotTools.cmake +++ b/CMakeModules/DepotTools.cmake @@ -14,39 +14,12 @@ if (WEBRTC_REVISION) ERROR "Unable to find webrtc commit date at ${WEBRTC_REVISION}" ) elseif (WEBRTC_BRANCH_HEAD) - libwebrtc_execute( - COMMAND ${GIT_EXECUTABLE} config remote.origin.fetch +refs/branch-heads/*:refs/remotes/branch-heads/* ^\\+refs/branch-heads/\\*:.*$ - OUTPUT_VARIABLE _WEBRTC_CONFIG_FETCH - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - STAMPFILE webrtc-config-fetch - STATUS "Setting up branch-heads refspecs" - ERROR "Unable to add branch-heads refspec to the git config" - ) - - libwebrtc_execute( - COMMAND ${GIT_EXECUTABLE} fetch origin ${WEBRTC_BRANCH_HEAD} - OUTPUT_VARIABLE _WEBRTC_FETCH - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - STAMPFILE webrtc-fetch-branch-heads - STATUS "Fetching ${WEBRTC_BRANCH_HEAD}" - ERROR "Unable to fetch ${WEBRTC_BRANCH_HEAD}" - ) - - libwebrtc_execute( - COMMAND ${GIT_EXECUTABLE} checkout FETCH_HEAD - OUTPUT_VARIABLE _WEBRTC_CHECKOUT - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - STAMPFILE webrtc-checkout-branch-head - STATUS "Checking out ${WEBRTC_BRANCH_HEAD}" - ERROR "Unable to checkout ${WEBRTC_BRANCH_HEAD}" - ) - libwebrtc_execute( COMMAND ${GIT_EXECUTABLE} log -1 --format=%ci OUTPUT_VARIABLE _WEBRTC_COMMIT_DATE WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} STAMPFILE webrtc-branch-head-commit-date - STATUS "Retrieving date for commit ${WEBRTC_BRANCH_HEAD}" + STATUS "Retrieving date for ${WEBRTC_BRANCH_HEAD}" ERROR "Unable to retrieve the commit date for ${WEBRTC_BRANCH_HEAD}" ) else (WEBRTC_REVISION) diff --git a/webrtc/CMakeLists.txt.in b/webrtc/CMakeLists.txt.in index e52b98a..4a7d07a 100644 --- a/webrtc/CMakeLists.txt.in +++ b/webrtc/CMakeLists.txt.in @@ -8,6 +8,46 @@ else (WIN32) find_package(PythonInterp 2.7 REQUIRED) endif (WIN32) +include(LibWebRTCExecute) + +if (WEBRTC_REVISION) + libwebrtc_execute( + COMMAND ${GIT_EXECUTABLE} checkout ${WEBRTC_REVISION} + OUTPUT_VARIABLE _WEBRTC_CHECKOUT + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + STAMPFILE webrtc-checkout-commit + STATUS "Checking out webrtc to commit ${WEBRTC_REVISION}" + ERROR "Unable to checkout webrtc to commit ${WEBRTC_REVISION}" + ) +elseif (WEBRTC_BRANCH_HEAD) + libwebrtc_execute( + COMMAND ${GIT_EXECUTABLE} config remote.origin.fetch +refs/branch-heads/*:refs/remotes/branch-heads/* ^\\+refs/branch-heads/\\*:.*$ + OUTPUT_VARIABLE _WEBRTC_CONFIG_FETCH + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + STAMPFILE webrtc-config-fetch + STATUS "Setting up branch-heads refspecs" + ERROR "Unable to add branch-heads refspec to the git config" + ) + + libwebrtc_execute( + COMMAND ${GIT_EXECUTABLE} fetch origin ${WEBRTC_BRANCH_HEAD} + OUTPUT_VARIABLE _WEBRTC_FETCH + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + STAMPFILE webrtc-fetch-branch-heads + STATUS "Fetching ${WEBRTC_BRANCH_HEAD}" + ERROR "Unable to fetch ${WEBRTC_BRANCH_HEAD}" + ) + + libwebrtc_execute( + COMMAND ${GIT_EXECUTABLE} checkout FETCH_HEAD + OUTPUT_VARIABLE _WEBRTC_CHECKOUT + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + STAMPFILE webrtc-checkout-branch-head + STATUS "Checking out ${WEBRTC_BRANCH_HEAD}" + ERROR "Unable to checkout ${WEBRTC_BRANCH_HEAD}" + ) +endif (WEBRTC_REVISION) + include(DepotTools) include(GClient) include(Environment)