mirror of
https://codeberg.org/armin/monostep.git
synced 2026-09-01 12:20:46 +02:00
22 lines
748 B
CMake
22 lines
748 B
CMake
|
|
# Generates BuildStamp.h with the current date/time. Run as a build-time
|
||
|
|
# custom command so the stamp is refreshed on every build (the TU that includes
|
||
|
|
# it is recompiled because the header mtime changes each time).
|
||
|
|
|
||
|
|
if(NOT DEFINED MONOSTEP_BUILD_STAMP_HEADER)
|
||
|
|
message(FATAL_ERROR "MONOSTEP_BUILD_STAMP_HEADER must be set")
|
||
|
|
endif()
|
||
|
|
|
||
|
|
string(TIMESTAMP STAMP "%Y-%m-%d__%H:%M:%S")
|
||
|
|
|
||
|
|
get_filename_component(MONOSTEP_BUILD_STAMP_DIR "${MONOSTEP_BUILD_STAMP_HEADER}" DIRECTORY)
|
||
|
|
file(MAKE_DIRECTORY "${MONOSTEP_BUILD_STAMP_DIR}")
|
||
|
|
|
||
|
|
file(WRITE "${MONOSTEP_BUILD_STAMP_HEADER}"
|
||
|
|
"// Generated at build time - do not edit.
|
||
|
|
#ifndef MONOSTEP_BUILD_STAMP_H_INCLUDED
|
||
|
|
#define MONOSTEP_BUILD_STAMP_H_INCLUDED
|
||
|
|
|
||
|
|
#define MONOSTEP_BUILD_DATE \"${STAMP}\"
|
||
|
|
|
||
|
|
#endif
|
||
|
|
")
|