Fetchcontent doesn't fetch from git if you specify the full SHA hash
If you do e.g.:
FetchContent_Declare(apps
GIT_REPOSITORY url/for/apps.git
GIT_TAG bcc8e615c1f3b5ea250b49ebcadb5549dd71c5de
)
FetchContent_GetProperties(apps)
if (NOT apps_POPULATED)
FetchContent_Populate(apps)
endif()
then when you update the hash, cmake will not fetch from the repository again. Instead you get fatal: reference is not a tree: bcc8e615c1f3b5ea250b49ebcadb5549dd71c5de
. This seems to be because get_hash_for_ref
in apps-populate-gitupdate.cmake
uses git rev-parse
, which returns the hash without error when you give it any full hash. If you delete some trailing characters from the hash it works fine.