diff --git a/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake b/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake index de8dcfa35d41..2443c61aad54 100644 --- a/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake +++ b/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake @@ -41,13 +41,8 @@ function(process_package pkg) 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}") - if(EXISTS ${GIT_REPO}/.git) - execute_process( - COMMAND git --git-dir=${GIT_REPO}/.git --work-tree=${GIT_REPO} log -n1 "--format=format:%h %aI %an" -- "${pkg}/${f}" - RESULT_VARIABLE RESULT_VAR - OUTPUT_VARIABLE OUT_VAR - ) - string(REPLACE "$Id$" "$Id: ${fname} ${OUT_VAR}" file_content "${file_content}") + if(GIT_HASH) + string(REPLACE "$Id$" "$Id: ${f} ${GIT_HASH} $" file_content "${file_content}") else() string(REPLACE "$Id$" "This file is from the release ${CGAL_VERSION} of CGAL" file_content "${file_content}") endif() @@ -74,6 +69,15 @@ if (NOT GIT_REPO) set(GIT_REPO ${CMAKE_BINARY_DIR}) endif() +if(EXISTS ${GIT_REPO}/.git) + execute_process( + COMMAND git --git-dir=${GIT_REPO}/.git --work-tree=${GIT_REPO} log -n1 "--format=format:%h" + RESULT_VARIABLE RESULT_VAR + OUTPUT_VARIABLE GIT_HASH + ) + string(REPLACE "$Id$" "$Id: ${fname} ${OUT_VAR}$" file_content "${file_content}") +endif() + if (NOT EXISTS ${GIT_REPO}/Installation/include/CGAL/version.h) message(FATAL_ERROR "Cannot find Installation/include/CGAL/version.h. Make sure you are at the root of a CGAL branch") endif()