Brian Waters | 13d9601 | 2017-12-08 16:53:31 -0600 | [diff] [blame] | 1 | # This file is called at build time. It regenerates the version.h file based on the hg version. |
| 2 | |
| 3 | EXECUTE_PROCESS( |
| 4 | COMMAND ${HGCOMMAND} id -i |
| 5 | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} |
| 6 | RESULT_VARIABLE reshash |
| 7 | OUTPUT_VARIABLE verhash |
| 8 | ERROR_QUIET |
| 9 | OUTPUT_STRIP_TRAILING_WHITESPACE) |
| 10 | EXECUTE_PROCESS( |
| 11 | COMMAND ${HGCOMMAND} id -n |
| 12 | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} |
| 13 | RESULT_VARIABLE resval |
| 14 | OUTPUT_VARIABLE verval |
| 15 | ERROR_QUIET |
| 16 | OUTPUT_STRIP_TRAILING_WHITESPACE) |
| 17 | |
| 18 | if (reshash EQUAL 0) |
| 19 | SET(FD_PROJECT_VERSION_HG "${verval}(${verhash})") |
| 20 | message(STATUS "Source version: ${FD_PROJECT_VERSION_HG}") |
| 21 | endif (reshash EQUAL 0) |
| 22 | |
| 23 | CONFIGURE_FILE(${SRC} ${DST}) |