cgal_create_release_with_cmake.cmake: only call Git one

This commit is contained in:
Laurent Rineau 2023-08-01 18:22:12 +02:00
parent 1d3456d6b0
commit 2e04088d1f
1 changed files with 11 additions and 7 deletions

View File

@ -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()