[CMake] Pass -fdiagnostics-color=always to GCC when building with Ninja
authoraperez@igalia.com <aperez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 May 2017 10:16:06 +0000 (10:16 +0000)
committeraperez@igalia.com <aperez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 May 2017 10:16:06 +0000 (10:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=172638

Reviewed by Yusuke Suzuki.

The oldest version of GCC supported for building WebKit is 4.9, which already accepts
-fdiagnostics-color=, therefore it is not needed to check the compiler version.

* Source/cmake/OptionsCommon.cmake:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217485 268f45cc-cd09-0410-ab3c-d52691b4dbfc

ChangeLog
Source/cmake/OptionsCommon.cmake

index d2fac74..8a87240 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2017-05-26  Adrian Perez de Castro  <aperez@igalia.com>
+
+        [CMake] Pass -fdiagnostics-color=always to GCC when building with Ninja
+        https://bugs.webkit.org/show_bug.cgi?id=172638
+
+        Reviewed by Yusuke Suzuki.
+
+        The oldest version of GCC supported for building WebKit is 4.9, which already accepts
+        -fdiagnostics-color=, therefore it is not needed to check the compiler version.
+
+        * Source/cmake/OptionsCommon.cmake:
+
 2017-05-25  Don Olmstead  <don.olmstead@am.sony.com>
 
         [CMake][Win] Use WTF_CPU not MSCV_CXX_ARCHITECTURE_ID when determining lib directories
index e77c707..b89503c 100644 (file)
@@ -43,9 +43,18 @@ if (COMPILER_IS_GCC_OR_CLANG)
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
 endif ()
 
-if (COMPILER_IS_CLANG AND CMAKE_GENERATOR STREQUAL "Ninja")
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcolor-diagnostics")
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics")
+if (CMAKE_GENERATOR STREQUAL "Ninja")
+    if (COMPILER_IS_CLANG)
+        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcolor-diagnostics")
+        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics")
+    else ()
+        if (CMAKE_COMPILER_IS_GNUCC)
+            set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-color=always")
+        endif ()
+        if (CMAKE_COMPILER_IS_GNUCXX)
+            set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always")
+        endif ()
+    endif ()
 endif ()
 
 if (WIN32 AND COMPILER_IS_GCC_OR_CLANG)