From 2e04088d1f2ddbd26a9d5189a1c187259242ccbb Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Tue, 1 Aug 2023 18:22:12 +0200 Subject: [PATCH] cgal_create_release_with_cmake.cmake: only call Git one --- .../cgal_create_release_with_cmake.cmake | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake b/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake index de8dcfa35d4..2443c61aad5 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()