using ctest on Linux and the test output appeared according to the colors being set by the test. This does not happen on Windows, getting the color codes as plain text.
I can see here: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/2577
that Sylvain Joubert writing on this same issue: I have been conservative and disabled color on Windows as I can't test on that platform. Are ANSI code supported on Windows or is there another way to output color to the console?
Looks like the current code still doesn’t support coloured output on Windows:
// Not supported on Windows
// On UNIX we need a non-dumb tty.
// ...<implementation omitted>
Part of this is likely that (AFAIK), colors are in-band on VT-alikes and out-of-band on Windows terminals. So color can be managed directly by the data stream on VT but windows requires calls to the terminal handle. Of course, maybe the new terminal understands ANSI color sequences, but I’ve not encountered the need yet either.
Answering to myself
Also thanking Craig as well for pointing to the code culprit.
Using mingw console on Windows and I can see the colors back, so this will be our workaround for now.
Also it surprised me to see that even though Windows and despite the above disabling code it still can work and show colors.