cmake: Fix default file translate mode when using libuv
On Windows, libuv's one-time initialization changes the C runtime
library's _fmode
setting to _O_BINARY
, thus causing files to open
as binary after that instead of the default _O_TEXT
mode. See
upstream libuv issue 840. Work around the problem by performing libuv
initialization early and then restoring _fmode
.
In particular, this currently affects server mode. Without this fix,
the _fmode
setting changes when the server mode initializes libuv.
Fixes: #16962 (closed)