Changeset View
Changeset View
Standalone View
Standalone View
build_files/cmake/buildinfo.cmake
| Show First 20 Lines • Show All 155 Lines • ▼ Show 20 Lines | |||||
| # Write a file with the BUILD_HASH define | # Write a file with the BUILD_HASH define | ||||
| file(WRITE buildinfo.h.txt | file(WRITE buildinfo.h.txt | ||||
| "#define BUILD_HASH \"${MY_WC_HASH}\"\n" | "#define BUILD_HASH \"${MY_WC_HASH}\"\n" | ||||
| "#define BUILD_COMMIT_TIMESTAMP ${MY_WC_COMMIT_TIMESTAMP}\n" | "#define BUILD_COMMIT_TIMESTAMP ${MY_WC_COMMIT_TIMESTAMP}\n" | ||||
| "#define BUILD_BRANCH \"${MY_WC_BRANCH}\"\n" | "#define BUILD_BRANCH \"${MY_WC_BRANCH}\"\n" | ||||
| "#define BUILD_DATE \"${BUILD_DATE}\"\n" | "#define BUILD_DATE \"${BUILD_DATE}\"\n" | ||||
| "#define BUILD_TIME \"${BUILD_TIME}\"\n" | "#define BUILD_TIME \"${BUILD_TIME}\"\n" | ||||
| "#include \"buildinfo_static.h\"\n" | |||||
| ) | ) | ||||
| # cleanup | # cleanup | ||||
| unset(MY_WC_HASH) | unset(MY_WC_HASH) | ||||
| unset(MY_WC_COMMIT_TIMESTAMP) | unset(MY_WC_COMMIT_TIMESTAMP) | ||||
| unset(MY_WC_BRANCH) | unset(MY_WC_BRANCH) | ||||
| unset(BUILD_DATE) | unset(BUILD_DATE) | ||||
| unset(BUILD_TIME) | unset(BUILD_TIME) | ||||
| # Copy the file to the final header only if the version changes | # Copy the file to the final header only if the version changes | ||||
| # and avoid needless rebuilds | # and avoid needless rebuilds | ||||
| # TODO: verify this comment is true, as BUILD_TIME probably changes | # TODO: verify this comment is true, as BUILD_TIME probably changes | ||||
| execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different | execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different | ||||
| buildinfo.h.txt buildinfo.h) | buildinfo.h.txt buildinfo.h) | ||||