mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-29 04:09:35 +03:00
StdIo: Restore compilation on 32-bit MinGW
In commit e419429616 (StdIo: Restore Windows Console I/O modes on
Ctrl-C, 2025-11-26, v4.1.4~4^2) we relied on the compiler to generate a
lambda with an `operator()` for each calling convention. MSVC does
this, but the GNU compiler for MinGW does not seem to.
This commit is contained in:
1 parent
6a5e9f299f
commit
c55dfbf656
1 file changed
+11
-7
+11
-7
@@ -93,19 +93,23 @@ public:
|
||||
|
||||
Globals();
|
||||
|
||||
#ifdef _WIN32
|
||||
static BOOL WINAPI CtrlHandler(DWORD /*dwCtrlType*/)
|
||||
{
|
||||
Get().StdErr.Destroy();
|
||||
Get().StdOut.Destroy();
|
||||
Get().StdIn.Destroy();
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
static Globals& Get();
|
||||
};
|
||||
|
||||
#ifdef _WIN32
|
||||
Globals::Globals()
|
||||
{
|
||||
static auto const ctrlHandler = [](DWORD /*dwCtrlType*/) -> BOOL {
|
||||
Get().StdErr.Destroy();
|
||||
Get().StdOut.Destroy();
|
||||
Get().StdIn.Destroy();
|
||||
return FALSE;
|
||||
};
|
||||
SetConsoleCtrlHandler(ctrlHandler, TRUE);
|
||||
SetConsoleCtrlHandler(CtrlHandler, TRUE);
|
||||
}
|
||||
#else
|
||||
Globals::Globals() = default;
|
||||
|
||||
Reference in new issue
Block a user