[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.
master
Matteo Cypriani 10 years ago
parent e51a8d4f1b
commit 209530ad41

@ -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(

Loading…
Cancel
Save