generate SVN like ID if generated from a git branch

This commit is contained in:
Sébastien Loriot 2017-11-20 12:13:22 +01:00
parent dd5a9163d0
commit 38810c9860
1 changed files with 10 additions and 1 deletions

View File

@ -70,7 +70,16 @@ foreach(pkg ${files})
if ("${fext}" STREQUAL ".h" OR "${fext}" STREQUAL ".hpp")
file(READ "${pkg_dir}/${f}" file_content)
string(REPLACE "$URL$" "$URL: ${GITHUB_PREFIX}/${pkg}/${f} $" file_content ${file_content})
string(REPLACE "$Id$" "This file is from the release ${CGAL_VERSION} of CGAL" file_content ${file_content})
if(EXISTS ${CMAKE_BINARY_DIR}/.git)
execute_process(
COMMAND git --git-dir=${CMAKE_BINARY_DIR}/.git --work-tree=${CMAKE_BINARY_DIR} log -n1 "--format=format:%h %aI %an"
RESULT_VARIABLE RESULT_VAR
OUTPUT_VARIABLE OUT_VAR
)
string(REPLACE "$Id$" "$Id: ${fname} ${OUT_VAR}" file_content ${file_content})
else()
string(REPLACE "$Id$" "This file is from the release ${CGAL_VERSION} of CGAL" file_content ${file_content})
endif()
file(WRITE ${release_dir}/${afile_dir}/${fname} ${file_content})
else()
file(COPY ${afile} DESTINATION ${release_dir}/${afile_dir})