I am using FetchContent
like below
FetchContent_Declare(
foo
GIT_REPOSITORY n ssh://foo-url
GIT_TAG 1.0.1
GIT_SHALLOW TRUE
SOURCE_DIR $ENV{HOME}/foo
)
FetchContent_MakeAvailable(foo)
If I explicitly delete foo (rm -rf ~/foo
). And re-configure or delete cache and reconfigure, I get the following error…
[cmake] [ 11%] Performing update step for 'foo-populate'
[cmake] CMake Error at /home/vagrant/cmake_external_dependencies/foo-subbuild/foo-populate-prefix/tmp/foo-populate-gitupdate.cmake:25 (message):
[cmake] Failed to get the hash for HEAD:
[cmake]
[cmake] fatal: not a git repository (or any parent up to mount point /home)
[cmake]
[cmake] Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
I’ve found my only option at this point is to delete the entire build directory (or specifically the foo-subbuild
directory). Do I have any options here? Or is this the expected behavior? I would’ve perhaps thought that FetchContent would’ve been able to realize the repo no longer exists and re-clone it like it does on first configuration.