cmake-modules
cmake-modules copied to clipboard
get_git_head_revision() fails due to unfound git
I was seeing an error like this (anonymized):
CMake Error: File XXX/MyProject/SubmodulesInThisDir/.git/modules/SubmodulesInThisDir/Submodule/HEAD does not exist.
CMake Error at SubmodulesInThisDir/Submodule/cmake/GetGitRevisionDescription.cmake:161 (configure_file):
configure_file Problem configuring file
Finally tracked it down to the fact that, for some reason, the get_git_head_revision() function of GetGitRevisionDescription does not include the
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
block that all the other public functions have. So, if this is the first GetGitRevisionDescription function you call, it takes the wrong code paths due to the inability to call Git and tries to configure the wrong file.