Building llvm/clang using cmake + ninja on cygin fails: -fcolor-diagnostic is passed on to g++


I'm able to properly generate the Ninja file with the following invocation:

-DCMAKE_CXX_COMPILER=clang++ ../llvm

But when trying to build it fails with:
/usr/bin/clang++ -DGTEST_HAS_RTTI=0 -DLLVMSupport_EXPORTS -D_DEBUG
-Wall -W -Wno-unused-parameter -Wwrite-strings
-Wmissing-field-initializers -pedantic -Wno-long-long
-Wcovered-switch-default -std=gnu++11 -fcolor-diagnostics -g -fPIC
-Ilib/Support -I/home/uidw8099/llvm/lib/Support -Iinclude
-I/home/uidw8099/llvm/include -fno-exceptions -fno-rtti -MMD -MT
lib/Support/CMakeFiles/LLVMSupport.dir/ARMBuildAttrs.cpp.o -MF
"lib/Support/CMakeFiles/LLVMSupport.dir/ARMBuildAttrs.cpp.o.d" -o
lib/Support/CMakeFiles/LLVMSupport.dir/ARMBuildAttrs.cpp.o -c
g++: error: unrecognized command line option ‘-fcolor-diagnostics’
clang: error: assembler (via gcc) command failed with exit code 1 (use
-v to see invocation)

At the end you can see that the -fcolor-diagnostic flag is added. Is
this a cmake problem or a Makelists problem in llvm configuration?

Why is this flag being passed on to the assembler anyway?


Why is your clang++ binary producing g++ error messages?

Or am I misreading this somehow?

Oh. Perhaps we’re forwarding that -f flag to the non-integrated linker. That would be a clang driver bug.

Is there any reason we don’t use the integrated assembler on Cygwin?