When `WITH_{examples|demos|tests}` is `ON`, `CGAL_SCM.cmake` is
included by each sub-directory. With this patch, the values of
`CGAL_SCM_BRANCH_NAME` and `CGAL_CREATED_GIT_HASH` are stored in
global properties, and retrieved, instead of forking two `git` at each
use of the module.
If the current working directory is a checkout of a commit that is not a
branch, for example, a commit in the ancestors of a branch, then CGAL CMake
scripts gave that CMake error:
== CMake setup ==
fatal: ref HEAD is not a symbolic ref
CMake Error at Installation/cmake/modules/CGAL_SCM.cmake:36 (string):
string sub-command REGEX, mode REPLACE needs at least 6 arguments total to
command.
Call Stack (most recent call first):
CMakeLists.txt:17 (include)
== CMake setup (DONE) ==
This patch fixes the error. If HEAD is not a branch, then CGAL_GIT_BRANCH
is equal to "HEAD".