From 209530ad419144baa378d79796d512704132f7fd Mon Sep 17 00:00:00 2001 From: Matteo Cypriani Date: Fri, 25 Jul 2014 15:15:48 -0400 Subject: [PATCH] [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. --- doc/CMakeLists.txt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index c05a514..4d40612 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -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(