Commit e123caf8 authored by A. Maitland Bottoms's avatar A. Maitland Bottoms Committed by michael-west

cmake: Add SOURCE_DATE_EPOCH

Reproducible builds set SOURCE_DATE_EPOCH rather than arbitrary
build timestamps. Use it if set, otherwise revert to the old way.
parent 1b9f51f9
......@@ -15,6 +15,11 @@ macro(UHD_LOAD_BUILD_INFO)
# Build date
if(IGNORE_BUILD_DATE)
set(UHD_BUILD_DATE "")
elseif(DEFINED ENV{SOURCE_DATE_EPOCH})
EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c
"import time; print(time.strftime('%a, %d %b %Y %H:%M:%S UTC', time.gmtime($ENV{SOURCE_DATE_EPOCH})))"
OUTPUT_VARIABLE UHD_BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE
)
else()
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c
"import time; print(time.strftime('%a, %d %b %Y %H:%M:%S', time.gmtime()))"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment