This allows to provide flags in the top-level CMake invocation for specifying e. g. a target processor to build builtins for, like this:
cmake -DBUILTINS_CMAKE_ARGS="-DCMAKE_C_FLAGS=-mcpu=cortex-a15" ../llvm
Building builtins as part of LLVM itself is exactly what I’m trying to accomplish. But it turns out there was no way to specify C flags just for builtins from the LLVM cmake invocation, which is what I’ve attempted to address here.
The global CMAKE_C_FLAGS will not be caught by builtins with this change simply because they won’t be passed to the “nested” CMake invocation. Instead, to specify CMAKE_C_FLAGS for builtins, you’ll need to pass them like this: -DBUILTINS_CMAKE_ARGS="-DCMAKE_C_FLAGS=..." when building LLVM.
This is assuming I got this whole CMake thing right (this is only my second contribution to LLVM). If not, I would appreciate any advice on how to pass C flags to builtins when building them as part of LLVM.