diff --git a/CMakeModules/gitid.cmake b/CMakeModules/gitid.cmake index 3d85482..270786b 100644 --- a/CMakeModules/gitid.cmake +++ b/CMakeModules/gitid.cmake @@ -18,6 +18,7 @@ if (GIT_EXECUTABLE) endif() message("Current git revision is ${MANUAL_GIT_ID}") set(MANUAL_GIT_ID "gitid: ${MANUAL_GIT_ID}") + set(MANUAL_GIT_ID "(MANUAL_GIT_ID)") else() set (MANUAL_GIT_ID) endif() @@ -25,6 +26,6 @@ endif() set (GIT_HEADER "gitid.tex") set (NEW_GIT_HEADER "new_gitid.tex") string(REPLACE "_" "\\_" SANITIZED_PROJECT_VERSION "${PROJECT_VERSION}") -file(WRITE ${NEW_GIT_HEADER} "\\newcommand{\\gitid}{${SANITIZED_PROJECT_VERSION} (${MANUAL_GIT_ID})}\n") +file(WRITE ${NEW_GIT_HEADER} "\\newcommand{\\gitid}{${SANITIZED_PROJECT_VERSION} ${MANUAL_GIT_ID}}\n") execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${NEW_GIT_HEADER} ${GIT_HEADER}) execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${NEW_GIT_HEADER}) diff --git a/reference/CMakeLists.txt b/reference/CMakeLists.txt index 55ec39d..b63f890 100644 --- a/reference/CMakeLists.txt +++ b/reference/CMakeLists.txt @@ -1,5 +1,5 @@ add_custom_command(OUTPUT ${CURRENT_DIR}/csgid.tex COMMAND VOTCASHARE=${CSG_SHARE} ${CSG_CALL} --help > csg_call.help - COMMAND sed -n -e "'s/.*version \\(.*\\)/\\\\newcommand{\\\\csgid}{\\1}/p'" csg_call.help - > ${CMAKE_CURRENT_BINARY_DIR}/${CURRENT_DIR}/csgid.tex + COMMAND sed -n -e "'s/.*version \\(.*\\)/\\1/p'" csg_call.help > csg_call.version + COMMAND sed -e "'s/_/\\\\&/g'" -e "'s/.*/\\\\newcommand{\\\\csgid}{&}/'" csg_call.version > ${CMAKE_CURRENT_BINARY_DIR}/${CURRENT_DIR}/csgid.tex DEPENDS ${CSG_CALL})