From 1bed0a68181c2488e11e9922cf630b43c6d7f35b Mon Sep 17 00:00:00 2001 From: Axel Isouard Date: Mon, 27 Mar 2017 19:59:16 +0200 Subject: [PATCH] Build version from current tag --- CMakeModules/Version.cmake | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/CMakeModules/Version.cmake b/CMakeModules/Version.cmake index 2c1fec9..7e67371 100644 --- a/CMakeModules/Version.cmake +++ b/CMakeModules/Version.cmake @@ -1,10 +1,23 @@ -set(LIBWEBRTC_MAJOR_VERSION 0) -set(LIBWEBRTC_MINOR_VERSION 0) -set(LIBWEBRTC_PATCH_VERSION 1) -set(LIBWEBRTC_BUILD_VERSION -rc.4) -set(LIBWEBRTC_WEBRTC_HEAD refs/branch-heads/57) +include(LibWebRTCExecute) + +libwebrtc_execute( + COMMAND ${GIT_EXECUTABLE} describe --tags --dirty=-dirty + OUTPUT_VARIABLE _LIBWEBRTC_TAG + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + STAMPFILE webrtc-current-tag + STATUS "Retrieving current git tag" + ERROR "Unable to retrieve the current git tag" +) +string(STRIP ${_LIBWEBRTC_TAG} _LIBWEBRTC_TAG) + +string(REGEX REPLACE "^v?([0-9]+)\\..*" "\\1" LIBWEBRTC_MAJOR_VERSION "${_LIBWEBRTC_TAG}") +string(REGEX REPLACE "^v?[0-9]+\\.([0-9]+).*" "\\1" LIBWEBRTC_MINOR_VERSION "${_LIBWEBRTC_TAG}") +string(REGEX REPLACE "^v?[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" LIBWEBRTC_PATCH_VERSION "${_LIBWEBRTC_TAG}") +string(REGEX REPLACE "^v?[0-9]+\\.[0-9]+\\.[0-9]+(.*)" "\\1" LIBWEBRTC_BUILD_VERSION "${_LIBWEBRTC_TAG}") set(LIBWEBRTC_API_VERSION "${LIBWEBRTC_MAJOR_VERSION}.${LIBWEBRTC_MINOR_VERSION}.${LIBWEBRTC_PATCH_VERSION}") set(LIBWEBRTC_VERSION ${LIBWEBRTC_API_VERSION}${LIBWEBRTC_BUILD_VERSION}) + +set(LIBWEBRTC_WEBRTC_HEAD refs/branch-heads/57)