GIT_SHALLOW 1 should turn off automatically when GIT_TAG is a hash in ExternalProject_Add()

Using cmake 3.26.5, so this might have already changed.

GIT_TAG 2e34234

The above command will fail when the git tag is a hash, but it will succeed when the git tag is a branch. Cmake should be smart to detect that the tag is a hash and turn off git shallow automatically.

Just curious: isn’t that rather a git bug?

How should CMake know that this is not your branch name?

Indeed; CMake has no idea how Git might interpret any given string. We might be able to guess, but it is better for this to be something specified at the call site directly.