Skip to content

Commit

Permalink
cgal_create_release_with_cmake.cmake: only call Git one
Browse files Browse the repository at this point in the history
  • Loading branch information
lrineau committed Aug 1, 2023
1 parent 1d3456d commit 2e04088
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 2e04088

Please sign in to comment.