mirror of
https://github.com/UltraCoderRU/libwebrtc.git
synced 2026-01-28 11:15:13 +00:00
Add libwebrtc_execute function, use it in DepotTools.cmake
This commit is contained in:
parent
b294fac627
commit
bbdd74ce9a
2 changed files with 61 additions and 8 deletions
|
|
@ -2,15 +2,17 @@ if (HAS_OWN_DEPOT_TOOLS)
|
||||||
return()
|
return()
|
||||||
endif (HAS_OWN_DEPOT_TOOLS)
|
endif (HAS_OWN_DEPOT_TOOLS)
|
||||||
|
|
||||||
if (WEBRTC_REVISION)
|
include(LibWebRTCExecute)
|
||||||
message(STATUS "Retrieving date for commit ${WEBRTC_REVISION}")
|
|
||||||
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --format=%ci ${WEBRTC_REVISION}
|
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
||||||
OUTPUT_VARIABLE _WEBRTC_COMMIT_DATE)
|
|
||||||
|
|
||||||
if (NOT _WEBRTC_COMMIT_DATE)
|
if (WEBRTC_REVISION)
|
||||||
message(FATAL_ERROR "-- Unable to find webrtc commit date at ${WEBRTC_REVISION}")
|
libwebrtc_execute(
|
||||||
endif (NOT _WEBRTC_COMMIT_DATE)
|
COMMAND ${GIT_EXECUTABLE} log -1 --format=%ci ${WEBRTC_REVISION}
|
||||||
|
OUTPUT_VARIABLE _WEBRTC_COMMIT_DATE
|
||||||
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
|
STAMPFILE webrtc-commit-date
|
||||||
|
STATUS "Retrieving date for commit ${WEBRTC_REVISION}"
|
||||||
|
ERROR "Unable to find webrtc commit date at ${WEBRTC_REVISION}"
|
||||||
|
)
|
||||||
elseif (WEBRTC_BRANCH_HEAD)
|
elseif (WEBRTC_BRANCH_HEAD)
|
||||||
message(STATUS "Retrieving branch-heads refspecs")
|
message(STATUS "Retrieving branch-heads refspecs")
|
||||||
execute_process(COMMAND ${GIT_EXECUTABLE} config remote.origin.fetch +refs/branch-heads/*:refs/remotes/branch-heads/* ^\\+refs/branch-heads/\\*:.*$
|
execute_process(COMMAND ${GIT_EXECUTABLE} config remote.origin.fetch +refs/branch-heads/*:refs/remotes/branch-heads/* ^\\+refs/branch-heads/\\*:.*$
|
||||||
|
|
|
||||||
51
CMakeModules/LibWebRTCExecute.cmake
Normal file
51
CMakeModules/LibWebRTCExecute.cmake
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
if (LIBWEBRTC_EXECUTE_INCLUDED)
|
||||||
|
return()
|
||||||
|
endif (LIBWEBRTC_EXECUTE_INCLUDED)
|
||||||
|
set(LIBWEBRTC_EXECUTE_INCLUDED true)
|
||||||
|
|
||||||
|
include(CMakeParseArguments)
|
||||||
|
include(Environment)
|
||||||
|
|
||||||
|
function (libwebrtc_execute)
|
||||||
|
set(ONE_VALUE_ARGS OUTPUT_VARIABLE WORKING_DIRECTORY STAMPFILE STATUS ERROR)
|
||||||
|
set(MULTI_VALUE_ARGS COMMAND)
|
||||||
|
cmake_parse_arguments(COMMAND "" "${ONE_VALUE_ARGS}" "${MULTI_VALUE_ARGS}" ${ARGN})
|
||||||
|
|
||||||
|
set(CMF_DIR ${CMAKE_BINARY_DIR}/CMakeFiles)
|
||||||
|
|
||||||
|
if (COMMAND_STAMPFILE)
|
||||||
|
set(STAMP_FILE "${CMF_DIR}/${COMMAND_STAMPFILE}")
|
||||||
|
|
||||||
|
if (EXISTS ${STAMP_FILE})
|
||||||
|
if (COMMAND_OUTPUT_VARIABLE)
|
||||||
|
file(READ ${STAMP_FILE} _OUTPUT)
|
||||||
|
|
||||||
|
if (_OUTPUT)
|
||||||
|
set(${COMMAND_OUTPUT_VARIABLE} ${_OUTPUT} PARENT_SCOPE)
|
||||||
|
endif (_OUTPUT)
|
||||||
|
endif (COMMAND_OUTPUT_VARIABLE)
|
||||||
|
|
||||||
|
return()
|
||||||
|
endif (EXISTS ${STAMP_FILE})
|
||||||
|
endif (COMMAND_STAMPFILE)
|
||||||
|
|
||||||
|
if (COMMAND_STATUS)
|
||||||
|
message(STATUS ${COMMAND_STATUS})
|
||||||
|
endif (COMMAND_STATUS)
|
||||||
|
|
||||||
|
execute_process(COMMAND ${COMMAND_COMMAND}
|
||||||
|
WORKING_DIRECTORY ${COMMAND_WORKING_DIRECTORY}
|
||||||
|
OUTPUT_VARIABLE _OUTPUT)
|
||||||
|
|
||||||
|
if (NOT _OUTPUT)
|
||||||
|
message(FATAL_ERROR "-- " ${COMMAND_ERROR})
|
||||||
|
endif (NOT _OUTPUT)
|
||||||
|
|
||||||
|
if (COMMAND_STAMP_FILE)
|
||||||
|
file(WRITE ${STAMP_FILE} ${_OUTPUT})
|
||||||
|
endif (COMMAND_STAMP_FILE)
|
||||||
|
|
||||||
|
if (COMMAND_OUTPUT_VARIABLE)
|
||||||
|
set(${COMMAND_OUTPUT_VARIABLE} ${_OUTPUT} PARENT_SCOPE)
|
||||||
|
endif (COMMAND_OUTPUT_VARIABLE)
|
||||||
|
endfunction ()
|
||||||
Loading…
Add table
Reference in a new issue