[PATCH] Add colored diagnostics when building LLVM with cmake + ninja + clang

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


Committed as r182878 with your comments taken into account.

Thanks for the review !
-- 
Arnaud A. de Grandmaison

On Wednesday 29 May 2013 15:48:09 Reid Kleckner wrote:


LGTM!


I'd been meaning to toss that into CMAKE_CXX_FLAGS locally, but I never actually got 
around to it.  Might as well do it globally so everyone benefits.


--- a/cmake/modules/HandleLLVMOptions.cmake
+++ b/cmake/modules/HandleLLVMOptions.cmake
@@ -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)
+  if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_GENERATOR 
STREQUAL "Ninja")


if (UNIX AND ...) ?  Looks like it needs wrapping too.


+    append("-fcolor-diagnostics" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+  endif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_GENERATOR 
STREQUAL "Ninja")


Most endif's in this file don't duplicate the condition, so I'd drop it.


+endif(UNIX)




Arnaud A. de GrandmaisonOn Tue, May 28, 2013 at 5:17 AM,  
<arnaud.adegm at gmail.com[1]> wrote:


Arnaud A. de GrandmaisonWhen invoked from Ninja, clang does not detect that it 
can use colors : see

https://github.com/martine/ninja/issues/174[2]
--


llvm-commits at cs.uiuc.edu[3]
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits[4]






--------
[1] mailto:arnaud.adegm at gmail.com
[2] https://github.com/martine/ninja/issues/174
[3] mailto:llvm-commits at cs.uiuc.edu
[4] http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130529/a7c03e31/attachment.html>


More information about the llvm-commits mailing list