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

Hello

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

cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=1
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_COMPILER=clang
-DCMAKE_CXX_COMPILER=clang++ ../llvm

But when trying to build it fails with:
/usr/bin/clang++ -DGTEST_HAS_RTTI=0 -DLLVMSupport_EXPORTS -D_DEBUG
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-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
/home/uidw8099/llvm/lib/Support/ARMBuildAttrs.cpp
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?

Cheers,
Red

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?