FetchContent_Declare with temporarily unreachable repositories

Hi everybody,

I’ve recently started using the methods around FetchContent_Declare to pull my external project components (Git, SVN) to my current CMake project and it works great so far. Today however was the first time I’ve tried to configure the project while my PC was not connected to our VPN. Obviously, at the first call of FetchContent_Declare or maybe the first call to FetchContent_MakeAvailable (don’t know where the error comes from exactly) CMake send out an error and stopped the configure process, because the repository URL could not be reached. I don’t know if this can somehow be avoided, because there were no updates or any changes in the repository anyway, but I could not continue working until I reconnected to the VPN. Wouldn’t it suffice to throw a warning here instead of an error? In case the external projects have been made available at least once the subdirectories should be available for a correct CMake configure/generate step.

Is there a way to implement this behavior atm?

Any insights or help would be greatly appreciated.

Best regards,

Cc: @craig.scott

Take a look at the FETCHCONTENT_UPDATES_DISCONNECTED variable. It is intended for pretty much your exact scenario. FETCHCONTENT_FULLY_DISCONNECTED may also be appropriate, depending on your situation and personal preferences.

That’s exactly what I was looking for. I don’t know how I missed it. I should read the documentation more carefully next time. Thank you Craig.