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

Commit

Permalink
gitid.cmake: sanitize project version
Browse files Browse the repository at this point in the history
LaTeX doesn't like _ in the version string, which we use in release
candidate version, e.g. 1.4_rc1
  • Loading branch information
junghans committed Dec 28, 2018
1 parent 7324c70 commit 7746915
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CMakeModules/gitid.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ endif()

set (GIT_HEADER "gitid.tex")
set (NEW_GIT_HEADER "new_gitid.tex")
file(WRITE ${NEW_GIT_HEADER} "\\newcommand{\\gitid}{${PROJECT_VERSION} (${MANUAL_GIT_ID})}\n")
string(REPLACE "_" "\\_" SANITIZED_PROJECT_VERSION "${PROJECT_VERSION}")
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})

0 comments on commit 7746915

Please sign in to comment.