[doc] CMake: use current date if not using Git

If not building against the source from the Git repository, the date
can't be retrieved with Git; in that case we use the current date in the
documentation.
This commit is contained in:
Matteo Cypriani 2014-07-25 15:15:48 -04:00
parent e51a8d4f1b
commit 209530ad41
1 changed files with 13 additions and 2 deletions

View File

@ -97,8 +97,19 @@ else()
OUTPUT_VARIABLE DATE
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
# Take only the first field (the date without the time)
string(REGEX REPLACE " .*" "" DATE ${DATE})
if (DATE)
# Take only the first field (the date without the time)
string(REGEX REPLACE " .*" "" DATE ${DATE})
else()
# Take today's date from the system instead
execute_process(
COMMAND date --iso-8601
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE RET
OUTPUT_VARIABLE DATE
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
# Command to generate the man page
add_custom_command(