Download timeouts when building singularity container


I am experimenting with building a singularity container for ls1, OSPRay, and MegaMol: ls1-mardyn/ls1-megamol.def at master · reinago/ls1-mardyn · GitHub
So far it works up to the OSPRay superbuild, but on my setup (singularity on Ubuntu 20LTS inside WSL2 on Windows 10), the automatic downloads of the OSPRay dependencies randomly fail (another one each time), i.e., the build hangs for 5 minutes (which is irritating), and then I get an error that the download was hanging and aborted. It could very well be an issue with my setup or internet connection, but I think that is beside the point. MegaMol uses FetchContent for its dependencies and I have not seen one fail yet, no idea why.

The OSPRay build uses file(DOWNLOAD …) as far as I can see. Given wonky setups and builds of this type, wouldn’t it be nice to generally have some environment variables that influence the behavior of libcurl inside CMake? Like timeout, retries, etc. I found that there are timeout options for the file command, but nothing about retrying? These options could default to env values as well so one does not need to mess with (several) files/projects…

Am I missing some other option/setting to get around my problem?