Skip to content
This repository has been archived by the owner on May 26, 2021. It is now read-only.

Commit

Permalink
cmake: fix version string for csg progs
Browse files Browse the repository at this point in the history
again replace _ by \_ to make LaTeX happy
  • Loading branch information
junghans committed Dec 28, 2018
1 parent 7746915 commit a812042
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CMakeModules/gitid.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ 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()

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})
4 changes: 2 additions & 2 deletions reference/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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})

0 comments on commit a812042

Please sign in to comment.