For example, when using the ExternalProject or FetchContent module additional data can be downloaded and used within CMake. If there is no internet connection these modules fail and CMake does not finish configuration no matter if downloading was done successful once. There are flags like FETCHCONTENT_FULLY_DISCONNECTED or FETCHCONTENT_UPDATES_DISCONNECTED to prevent checks and therefore prevent failing. But these have to be set manually. (related question: cmake: external project update and a work offline).
Is it possible to check if there is a connection to afterwards set FETCHCONTENT_FULLY_DISCONNECTED automatically? How to do that? Or are there alternative ways to prevent failing of CMake if there is no internet connection?
In our case we are downloading libraries with FetchContent and than use for example find_package to make them available. Our workflow does currently not include manual adjusting of CMake Options/Variables and we do not want to add that. CMake gets all needed options by the IDEs we use, e.g. CMAKE_BUILD_TYPE or custom flags. We would need to double the targets to have a non-connection version for each existing combination. Therefore this semi-manual approach is also not feasible.