Skip to content

Commit

Permalink
cmake: Use date command on cmake <3.10 so %B works
Browse files Browse the repository at this point in the history
Previously cmake fell back on using the date command in favour of
TIMESTAMP when the cmake version was 3.8 or older. This lead to a case
where a literal %B was added in the Bareos date when building with
cmake 3.8 to 3.10.
This patch makes cmake fall back to use the date command on versions up
to 3.10.
  • Loading branch information
arogge authored and pstorz committed Jan 15, 2020
1 parent 2e0daf6 commit 59ccd12
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/cmake/BareosTimeFunctions.cmake
Expand Up @@ -16,7 +16,7 @@
# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

function(timestamp_at at result format)
if(CMAKE_VERSION VERSION_GREATER 3.8.0)
if(CMAKE_VERSION VERSION_GREATER 3.10.0)
set(old_epoch "$ENV{SOURCE_DATE_EPOCH}")
set(ENV{SOURCE_DATE_EPOCH} "${at}")
string(TIMESTAMP out "${format}" UTC)
Expand All @@ -33,7 +33,7 @@ function(timestamp_at at result format)
if(out STREQUAL "")
message(
FATAL_ERROR
"Cannot use SOURCE_DATE_EPOCH (cmake < 3.8) and your 'date' command is not compatible with Bareos' timestamp_at()."
"Cannot use SOURCE_DATE_EPOCH (cmake < 3.10) and your 'date' command is not compatible with Bareos' timestamp_at()."
)
endif()
endif()
Expand Down

0 comments on commit 59ccd12

Please sign in to comment.