Add a variable to be able to check if ANSI color escape sequences are supported
As required in !6747 (closed) i create an issue for this case.
Doing something like this runs nicely in some terminals and not in others or in CLion Visual Studio and cmake-gui :
string(ASCII 27 Esc)
set(Green "${Esc}[32m")
set(Reset "${Esc}[0m")
message(STATUS "${Green}Color${Reset}")
It seems that CMake is using colors in 3.21 when it is supported. It would be nice to have a read-only variable to check if ANSI color escape sequences are supported. To be able to do something like this
if(CMAKE_COLOR)
string(ASCII 27 Esc)
set(Green "${Esc}[32m")
set(Reset "${Esc}[0m")
endif()
message(STATUS "${Green}Color${Reset}")