mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-24 07:28:54 -06: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:
@@ -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