Skip to content

Commit

Permalink
Merge pull request #7628 from lrineau/Scripts-fix_cgal_create_release…
Browse files Browse the repository at this point in the history
…_with_cmake.cmake-GF

cgal_create_release_with_cmake.cmake: only call Git one
  • Loading branch information
lrineau committed Aug 28, 2023
2 parents eb70c2f + 2e04088 commit 603d2b2
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions Scripts/developer_scripts/cgal_create_release_with_cmake.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand Down

0 comments on commit 603d2b2

Please sign in to comment.