ExternalProject/FetchContent_Add with unresolveable URL hangs forever on Windows, how to fix/prevent.

I’m using FetchContent_ and had a typo in the URL which made CMake (4.0.3) hang forever. I tried adding TIMEOUT and INACTIVITY_TIMEOUT which didn’t do anything. Is this a bug or should I use another solution to at least get an error/timeout?

In my experience, such cases do eventually timeout and give an error. I haven’t seen it hang indefinitely before just because a URL was wrong. For cases that do hang, it is usually because ExternalProject/FetchContent is waiting for user input to enter a password for a SSH key or something similar. To check if that’s what’s happening to you, add USES_TERMINAL_DOWNLOAD YES to the ExternalProject_Add() or FetchContent_Declare() arguments.

Thanks Craig! In this case it was just a typo in an hostname which couldn’t be resolved. I would indeed also expect it to timeout and that the timeout is controlled via the TIMEOUT property, but this didn’t seem to have any impact.