Clang on Windows does not show color diagnostics unless -fansi-escape-codes is added
On Windows, setting both environment variables CMAKE_COLOR_DIAGNOSTICS=1
and CLICOLOR_FORCE=1
still doesn't get Clang to output diagnostics in color. The only way I managed to get color output out of it is to add -fansi-escape-codes
to the C/CXX flags. I tested two different scenarios:
- Windows console (cmd.exe) + ninja + llvm-mingw
- GitHub Actions Windows runner + mingw32-make + llvm-mingw
I am not sure if this counts as a CMake issue or Clang's, but Clang always uses the Windows console API by default unless -fansi-escape-codes is given, and I guess it doesn't have direct access to the Windows console when run under make or ninja.