CMAKE_COLOR_DIAGNOSTICS does not work with Clang on Windows when using the MSVC runtime + GNU frontend provided by LLVM's installer
Hello,
After diving deep into figuring out why -fcolor-diagnostics
and -fansi-escape-codes
were not being enabled when using Clang (as provided by the LLVM project's windows installer) with the GNU frontend, but targeting the MSVC runtime, I discovered that CMAKE_COLOR_DIAGNOSTICS
does nothing at all, as the CMAKE_${lang}_SIMULATE_ID
check always returns true in this use case.
This means that the resulting assignment in the alternative __compiler_lang
macro is also never reached.
Now, quite a bit of logic appears to be duplicated in Windows-Clang.cmake
, so I think this logic could easily be moved there, as this is also where the CMAKE_${lang}_FRONTEND_VARIANT
checks exist as well.
I was also able to confirm that by manually setting the CMAKE_${lang}_COMPILE_OPTIONS_COLOR_DIAGNOSTICS
before enabling a language did work correctly.