Control C++ compiler flags in gradle build file

Has anyone found documentation about (or figured out) how to pass custom flags to the c++ compiler by making changes in the file?
After a horrible experience with a function that did not have a return statement caused by lack of certain preprocessor symbol definitions that we used in our previous build system, we want to enable warnings for such things as well as be able to define our own preprocessor symbols.
After hours of studying gradlerio documentation, gradle documentation, and the cpp plugin documentation I still have no clue about how to do this seemingly very basic task.
I’d appreciate any help that anyone can offer.

Inside your build.gradle:

model {
 components {
  frcUserProgram(/* ... */) {
   binaries.all {
    if ( == wpi.platforms.roborio)
     cppCompiler.args << '-Wall'

You can see more examples here:

The official gradle docs for it are here:

Thank you! What was not clear from the docs was the context required for the cppCompiler.define and linker.args method applications. Your help is greatly appreciated.