| 1 |
#${CMAKE_COMMAND} -DVERSION_OUT_FILE=v -DVERSION_IN_FILE=src/rt/VERSION -DVERSION_GOLD=src/rt/Version.c -P src/common/create_version.cmake
|
| 2 |
|
| 3 |
# if the gold version exists then use that instead
|
| 4 |
if(EXISTS "${VERSION_GOLD}")
|
| 5 |
configure_file("${VERSION_GOLD}" "${VERSION_OUT_FILE}" COPYONLY)
|
| 6 |
return()
|
| 7 |
endif()
|
| 8 |
|
| 9 |
find_program(DATE date)
|
| 10 |
if(DATE)
|
| 11 |
execute_process(COMMAND ${DATE} OUTPUT_VARIABLE DATE_STR)
|
| 12 |
string(STRIP "${DATE_STR}" DATE_STR)
|
| 13 |
endif()
|
| 14 |
find_program(WHO whoami)
|
| 15 |
if(WHO)
|
| 16 |
execute_process(COMMAND ${WHO} OUTPUT_VARIABLE WHO_STR)
|
| 17 |
string(STRIP "${WHO_STR}" WHO_STR)
|
| 18 |
endif()
|
| 19 |
find_program(HOSTNAME hostname)
|
| 20 |
if(HOSTNAME)
|
| 21 |
execute_process(COMMAND ${HOSTNAME} OUTPUT_VARIABLE HOST_STR)
|
| 22 |
message("DATE= ${DATE_STR}")
|
| 23 |
string(STRIP "${HOST_STR}" HOST_STR)
|
| 24 |
endif()
|
| 25 |
file(READ "${VERSION_IN_FILE}" VERSION)
|
| 26 |
string(STRIP "${VERSION}" VERSION)
|
| 27 |
message("${VERSION}")
|
| 28 |
file(WRITE "${VERSION_OUT_FILE}"
|
| 29 |
"char VersionID[]=\"${VERSION} lastmod ${DATE_STR}"
|
| 30 |
" by ${WHO_STR} on ${HOST_STR}\";\n"
|
| 31 |
)
|
| 32 |
|
| 33 |
# todo actually get the date, user name and hostname in this script
|