summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'llvm')
-rw-r--r--llvm/cmake/modules/HandleLLVMOptions.cmake10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index 7687a4663e4..676f1569cfe 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -720,11 +720,13 @@ add_definitions( -D__STDC_CONSTANT_MACROS )
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
OpenPOWER on IntegriCloud