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 gradle.build 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 (targetPlatform.name == wpi.platforms.roborio)
     cppCompiler.args << '-Wall'
   }
  }
 }
}

You can see more examples here:

The official gradle docs for it are here:
https://docs.gradle.org/current/userguide/native_software.html#example_settings_that_apply_only_to_shared_libraries_produced_for_the_main_library_component

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.

Carl