Skip to content

Commit 729bb0a

Browse files
committed
Colored output is disabled by default on Windows.
Define the NOCOLOR constant to disable it in other systems. Reviewer: Luciano Wolf <[email protected]> Renato Araújo <[email protected]>
1 parent de37160 commit 729bb0a

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if (NOT DISABLE_DOCSTRINGS)
1818
endif()
1919

2020
if(MSVC)
21-
set(CMAKE_CXX_FLAGS "/Zc:wchar_t- /GR /EHsc /DNOCOLOR /DWIN32 /D_WINDOWS /D_SCL_SECURE_NO_WARNINGS")
21+
set(CMAKE_CXX_FLAGS "/Zc:wchar_t- /GR /EHsc /DWIN32 /D_WINDOWS /D_SCL_SECURE_NO_WARNINGS")
2222
elseif(CMAKE_HOST_UNIX)
2323
option(ENABLE_GCC_OPTIMIZATION "Enable specific GCC flags to optimize library size and performance. Only available on Release Mode" 0)
2424
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fvisibility=hidden")

reporthandler.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@
2929
#include <cstdarg>
3030
#include <cstdio>
3131

32-
#ifndef NOCOLOR
33-
#define COLOR_END "\033[0m"
34-
#define COLOR_WHITE "\033[1;37m"
35-
#define COLOR_YELLOW "\033[1;33m"
36-
#define COLOR_GREEN "\033[0;32m"
32+
#if _WINDOWS || NOCOLOR
33+
#define COLOR_END ""
34+
#define COLOR_WHITE ""
35+
#define COLOR_YELLOW ""
36+
#define COLOR_GREEN ""
3737
#else
38-
#define COLOR_END ""
39-
#define COLOR_WHITE ""
40-
#define COLOR_YELLOW ""
41-
#define COLOR_GREEN ""
38+
#define COLOR_END "\033[0m"
39+
#define COLOR_WHITE "\033[1;37m"
40+
#define COLOR_YELLOW "\033[1;33m"
41+
#define COLOR_GREEN "\033[0;32m"
4242
#endif
4343

4444
static bool m_silent = false;

0 commit comments

Comments
 (0)