[PATCH] D47083: Enable colored diagnostics when building with gcc 4.9+.
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 18 11:54:11 PDT 2018
thakis created this revision.
thakis added a reviewer: rnk.
Herald added a subscriber: mgorny.
GCC has supported -fdiagnostics-color since 4.9.
https://reviews.llvm.org/D47083
Files:
cmake/modules/HandleLLVMOptions.cmake
Index: cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- cmake/modules/HandleLLVMOptions.cmake
+++ cmake/modules/HandleLLVMOptions.cmake
@@ -720,11 +720,13 @@
add_definitions( -D__STDC_FORMAT_MACROS )
add_definitions( -D__STDC_LIMIT_MACROS )
-# clang doesn't print colored diagnostics when invoked from Ninja
+# clang and gcc don't default-print colored diagnostics when invoked from Ninja.
if (UNIX AND
- CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND
- CMAKE_GENERATOR STREQUAL "Ninja")
- append("-fcolor-diagnostics" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+ CMAKE_GENERATOR STREQUAL "Ninja" AND
+ (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
+ (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND
+ NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9))))
+ append("-fdiagnostics-color" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
endif()
# lld doesn't print colored diagnostics when invoked from Ninja
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47083.147570.patch
Type: text/x-patch
Size: 954 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180518/6b77271a/attachment.bin>
More information about the llvm-commits
mailing list