Executing native build in chroot

I am looking at a situtation where the gcc toolchain has to be executed within a chroot. I would like to put a Gradle build around this, but reconfigure the native components to call the chroot first.

I was wondering if the below would be a recommended approach

model {
  toolChains(Gcc) {
  eachPlatform {
   cppCompiler.with {
     executable '/path/to/chroot-script'
     withArguments { args ->
       args.add 0 , '-s', 'i', 'g++'    // -s, -i are parameters for chroot script, then g++ is the compiler to be run.
     }
   }
  }
}

(Was thinking of doing the same thing to run G++ under Coverity in another project, so not quite a once-off solution)