Commit 33d0d3c3 authored by Mathieu Faverge's avatar Mathieu Faverge

Replace the svn command to set the revision by git

parent 20a4df27
......@@ -6,30 +6,23 @@ set (VITE_VERSION_MAJOR 1)
set (VITE_VERSION_MINOR 2)
set (VITE_VERSION_PATCH 0)
find_package(Subversion)
if(SUBVERSION_FOUND)
# the subversion commands should be executed with the C locale, otherwise
# the message (which are parsed) may be translated, Alex
set(_Subversion_SAVED_LC_ALL "$ENV{LC_ALL}")
set(ENV{LC_ALL} C)
execute_process(COMMAND ${Subversion_SVN_EXECUTABLE} info ${PROJECT_SOURCE_DIR}
find_package(Git)
if(GIT_FOUND)
execute_process(COMMAND ${GIT_EXECUTABLE} show --no-patch --format="%h %aI"
OUTPUT_VARIABLE VITE_WC_INFO
ERROR_VARIABLE Subversion_svn_info_error
RESULT_VARIABLE Subversion_svn_info_result
ERROR_VARIABLE Git_info_error
RESULT_VARIABLE Git_info_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT ${Subversion_svn_info_result} EQUAL 0)
set(VITE_WC_REVISION "released")
if(NOT ${Git_info_result} EQUAL 0)
set(VITE_WC_REVISION "")
set(VITE_WC_DATE "")
else()
string(REGEX REPLACE "^(.*\n)?Last Changed Rev: ([^\n]+).*"
"\\2" VITE_WC_REVISION "${VITE_WC_INFO}")
string(REGEX REPLACE "^\"(.*) (.*)\"$"
"\\1" VITE_WC_REVISION "${VITE_WC_INFO}")
string(REGEX REPLACE "^\"(.*) (.*)\"$"
"\\2" VITE_WC_DATE "${VITE_WC_INFO}")
endif()
message(STATUS "Current revision is ${VITE_WC_REVISION}")
# restore the previous LC_ALL
set(ENV{LC_ALL} ${_Subversion_SAVED_LC_ALL})
endif()
if (NOT ${VITE_WC_REVISION} STREQUAL "")
......@@ -38,22 +31,28 @@ else()
set (VITE_VERSION "${VITE_VERSION_MAJOR}.${VITE_VERSION_MINOR}.${VITE_VERSION_PATCH}")
endif()
if(UNIX)
set(_vite_SAVED_LC_ALL "$ENV{LC_ALL}")
set(ENV{LC_ALL} C)
execute_process(COMMAND date +"%B %Y"
OUTPUT_VARIABLE VITE_DATE
ERROR_VARIABLE vite_date_error
RESULT_VARIABLE vite_date_result
OUTPUT_STRIP_TRAILING_WHITESPACE )
# restore the previous LC_ALL
set(ENV{LC_ALL} ${_vite_SAVED_LC_ALL})
if (NOT ${VITE_WC_DATE} STREQUAL "")
set (VITE_DATE "${VITE_WC_DATE}")
else()
set(VITE_DATE "")
if(UNIX)
set(_vite_SAVED_LC_ALL "$ENV{LC_ALL}")
set(ENV{LC_ALL} C)
execute_process(COMMAND date +"%B %Y"
OUTPUT_VARIABLE VITE_DATE
ERROR_VARIABLE vite_date_error
RESULT_VARIABLE vite_date_result
OUTPUT_STRIP_TRAILING_WHITESPACE )
# restore the previous LC_ALL
set(ENV{LC_ALL} ${_vite_SAVED_LC_ALL})
else()
set(VITE_DATE "")
endif()
endif()
message(STATUS "Current revision is ${VITE_VERSION} from ${VITE_DATE}")
if(COMMAND CMAKE_POLICY)
# CMP0003: add the link paths to the link command as with cmake 2.4
cmake_policy(SET CMP0003 NEW)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment