From a580ee9a1dcec02b3b845ababb93669b72fbdc97 Mon Sep 17 00:00:00 2001
From: Norihiro Watanabe <norihiro.watanabe@aist.go.jp>
Date: Wed, 7 Aug 2019 06:51:02 +0900
Subject: [PATCH] [cmake] coloring compiler output

---
 scripts/cmake/CompilerSetup.cmake | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/scripts/cmake/CompilerSetup.cmake b/scripts/cmake/CompilerSetup.cmake
index ba7381a9616..641699222ff 100644
--- a/scripts/cmake/CompilerSetup.cmake
+++ b/scripts/cmake/CompilerSetup.cmake
@@ -54,6 +54,16 @@ if(COMPILER_IS_GCC OR COMPILER_IS_CLANG OR COMPILER_IS_INTEL)
         -Wextra
     )
 
+    # Coloring output
+    option (FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." ON)
+    if (${FORCE_COLORED_OUTPUT})
+        if (COMPILER_IS_GCC)
+            add_compile_options (-fdiagnostics-color=always)
+        elseif (COMPILER_IS_CLANG)
+            add_compile_options (-fcolor-diagnostics)
+        endif ()
+    endif()
+
     # Profiling
     if(OGS_PROFILE)
         if(NOT CMAKE_BUILD_TYPE STREQUAL "Release")
-- 
GitLab