Commit fa7f9775 authored by Mathieu Faverge's avatar Mathieu Faverge

Add check for revision number and date in the CMakeLists.txt

parent f928425f
......@@ -6,6 +6,54 @@ 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}
OUTPUT_VARIABLE VITE_WC_INFO
ERROR_VARIABLE Subversion_svn_info_error
RESULT_VARIABLE Subversion_svn_info_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT ${Subversion_svn_info_result} EQUAL 0)
set(VITE_WC_REVISION "released")
else()
string(REGEX REPLACE "^(.*\n)?Last Changed Rev: ([^\n]+).*"
"\\2" VITE_WC_REVISION "${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 "")
set (VITE_VERSION "r${VITE_WC_REVISION}")
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})
else()
set(VITE_DATE "")
endif()
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