A version of this change was originally part of my patch at http://reviews.llvm.org/D7828 where it was suggested to split this part out into a separate review. Currently this patch is effectively an NFC but is required as a prerequisite for my other changes to embed Windows version information into executable and dll files as the warning flags are not recognised by the Microsoft resource compiler and the CMake Ninja generator does not filter out invalid flags from the definitions.
Here is my previous comment on this change (from http://reviews.llvm.org/D7828 ):
"I've had to make small change to HandleLLVMOptions.cmake to support the CMake Ninja generator. Previously the MSVC-specific warning flags were being added from add_llvm_definitions. The Visual Studio generators use a filter to make sure that only valid flags are passed through to the resource compiler, however the Ninja generator expects that this will only ever contain definitions and passes everything through unfiltered leading to errors from the resource compiler when given invalid flags. I've changed the behaviour so these warning flags are now added to CMAKE_C_FLAGS and CMAKE_CXX_FLAGS directly."
Thanks!
-Greg
It might also be faster to string-ify the list like this:
And append that one string to every CMAKE_*_FLAGS var we need to touch.