[llvm] r182878 - Add colored diagnostics when building LLVM with cmake + ninja + clang

Arnaud A. de Grandmaison arnaud.adegm at gmail.com
Wed May 29 13:41:35 PDT 2013


Author: aadg
Date: Wed May 29 15:41:35 2013
New Revision: 182878

URL: http://llvm.org/viewvc/llvm-project?rev=182878&view=rev
Log:
Add colored diagnostics when building LLVM with cmake + ninja + clang

When invoked from Ninja, clang does not detect that it can use colors : see https://github.com/martine/ninja/issues/174

Modified:
    llvm/trunk/cmake/modules/HandleLLVMOptions.cmake

Modified: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMOptions.cmake?rev=182878&r1=182877&r2=182878&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake (original)
+++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Wed May 29 15:41:35 2013
@@ -266,3 +266,10 @@ endif()
 add_llvm_definitions( -D__STDC_CONSTANT_MACROS )
 add_llvm_definitions( -D__STDC_FORMAT_MACROS )
 add_llvm_definitions( -D__STDC_LIMIT_MACROS )
+
+# clang doesn't print colored diagnostics when invoked from Ninja
+if (UNIX AND
+    CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND
+    CMAKE_GENERATOR STREQUAL "Ninja")
+  append("-fcolor-diagnostics" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+endif()





More information about the llvm-commits mailing list