Update Git version time format

This commit is contained in:
Christian W. Zuckschwerdt 2019-02-28 13:31:20 +00:00
parent 17d8dcf42b
commit 4506c4758c
3 changed files with 7 additions and 5 deletions

View file

@ -33,7 +33,8 @@ if(GIT_COMMIT) # is a git repo
# use lightweight (non-annotated) tags
git_describe(GIT_VERSION "--tags")
git_timestamp(GIT_TIMESTAMP)
message(STATUS "Using Git version tag: ${GIT_VERSION} on ${GIT_BRANCH} at ${GIT_TIMESTAMP} (${GIT_REFSPEC} commit ${GIT_COMMIT})")
message(STATUS "Found Git version: ${GIT_REFSPEC} commit ${GIT_COMMIT} from ${GIT_TIMESTAMP_ISO}")
message(STATUS "Using Git version tag: ${GIT_VERSION} on ${GIT_BRANCH} at ${GIT_TIMESTAMP}")
ADD_DEFINITIONS(-DGIT_VERSION=${GIT_VERSION})
ADD_DEFINITIONS(-DGIT_BRANCH=${GIT_BRANCH})
ADD_DEFINITIONS(-DGIT_TIMESTAMP=${GIT_TIMESTAMP})
@ -160,7 +161,7 @@ if(BUILD_DOCUMENTATION)
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
message("Doxygen build started")
message(STATUS "Doxygen build started")
# note the option ALL which allows to build the docs together with the application
add_custom_target(doc_doxygen ALL

View file

@ -158,14 +158,15 @@ function(git_timestamp _var)
return()
endif()
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --format="%ci" ${hash} ${ARGN}
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --format=%cI ${hash} ${ARGN}
WORKING_DIRECTORY ${GIT_DIR}
RESULT_VARIABLE res
OUTPUT_VARIABLE out
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(res EQUAL 0)
string(REGEX REPLACE "[-\" :]" "" out ${out})
set(${_var}_ISO ${out} PARENT_SCOPE)
string(REGEX REPLACE "[-T:]" "" out ${out})
string(SUBSTRING ${out} 0 12 out)
else()
set(out "${out}-${res}-NOTFOUND")

View file

@ -1,4 +1,4 @@
#
#
# Internal file for GetGitRevisionDescription.cmake
#
# Requires CMake 2.6 or newer (uses the 'function' command)