summaryrefslogtreecommitdiffstats
path: root/Source/cmakemain.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-01-23 13:55:58 (GMT)
committerBrad King <brad.king@kitware.com>2018-01-23 14:29:07 (GMT)
commit98628de812c4724fb2da199abb5fe08eeb5a1a64 (patch)
tree66e7c15536fede8e4b4f266147d19754e48311b8 /Source/cmakemain.cxx
parent3b588ac58256540e6dc974cf2d1a122c95f19171 (diff)
downloadCMake-98628de812c4724fb2da199abb5fe08eeb5a1a64.zip
CMake-98628de812c4724fb2da199abb5fe08eeb5a1a64.tar.gz
CMake-98628de812c4724fb2da199abb5fe08eeb5a1a64.tar.bz2
Extend libuv file translate mode workaround to all executables
Since libuv commit v1.14.1~7 (win: add uv__once_init() calls, 2017-08-30) the libuv initialization of the file translate mode may take place even if we do not use a uv loop. This change was included in our libuv update commit f4a26c748b (libuv 2018-01-19). Therefore use of libuv even through `cmSystemTools::GetRealPath` in any executable may trigger its file translate mode setting. Factor out the logic added to `cmake.exe` by commit v3.9.0-rc4~10^2 (cmake: Fix default file translate mode when using libuv, 2017-06-13) and re-use to initialize all executables. Issue: #16962
Diffstat (limited to 'Source/cmakemain.cxx')
-rw-r--r--Source/cmakemain.cxx17
1 files changed, 1 insertions, 16 deletions
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 59b908a..b185a1b 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -16,10 +16,6 @@
#include "cmDynamicLoader.h"
#endif
-#ifdef _WIN32
-#include <fcntl.h> /* _O_TEXT */
-#include <stdlib.h> /* _set_fmode, _fmode */
-#endif
#include "cm_uv.h"
#include "cmsys/Encoding.hxx"
@@ -170,19 +166,8 @@ int main(int ac, char const* const* av)
ac = args.argc();
av = args.argv();
-#if defined(_WIN32)
- // Perform libuv one-time initialization now, and then un-do its
- // global _fmode setting so that using libuv does not change the
- // default file text/binary mode. See libuv issue 840.
- uv_loop_close(uv_default_loop());
-#ifdef _MSC_VER
- _set_fmode(_O_TEXT);
-#else
- _fmode = _O_TEXT;
-#endif
-#endif
-
cmSystemTools::EnableMSVCDebugHook();
+ cmSystemTools::InitializeLibUV();
cmSystemTools::FindCMakeResources(av[0]);
if (ac > 1) {
if (strcmp(av[1], "--build") == 0) {