Just discovered this behavior while using cmake 3.1.16 on Windows. No other reports on this variable so I presume it may still lurk as bug (or surprise).
I have two Gits installed on my system, and I want cmake to use the second one; without intervention, it finds the first one. There are two methods I know:
Set an environment variable:
set GIT_EXECUTABLE=C:/second/git/cmd
or
cmake command line argument:
-DGIT_EXECUTABLE=C:/second/git/cmd/git.exe
Note the 2nd method requires the path include the executable! If the .exe name is omitted, things will appear to work until use of $(GIT_EXECUTABLE) within cmake CMLs or modules.