cginternals/cmake-init

GetGitRevisionDescription fails on new repository (before push)

sbusch42 opened this issue · 0 comments

When trying to build a project in a new git repository, before the first push, some git directories are not yet set up and the GetGitRevisionDescription.cmake script fails. The script should check if directories exist before trying to access them.

CMake Error: File /workspace/projects/cginternals/cppfs/.git/packed-refs does not exist.

CMake Error at build/CMakeFiles/git-data/grabRef.cmake:27 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
cmake/GetGitRevisionDescription.cmake:77 (include)
CMakeLists.txt:37 (get_git_head_revision)

CMake Error at build/CMakeFiles/git-data/grabRef.cmake:28 (file):
file failed to open for reading (No such file or directory):
/workspace/projects/cginternals/cppfs/build/CMakeFiles/git-data/packed-refs
Call Stack (most recent call first):
cmake/GetGitRevisionDescription.cmake:77 (include)
CMakeLists.txt:37 (get_git_head_revision)

CMake Error at build/CMakeFiles/git-data/grabRef.cmake:39 (file):
file failed to open for reading (No such file or directory):
/workspace/projects/cginternals/cppfs/build/CMakeFiles/git-data/head-ref
Call Stack (most recent call first):
cmake/GetGitRevisionDescription.cmake:77 (include)
CMakeLists.txt:37 (get_git_head_revision)