Native Build Flags Not Passed to Compiler/Linker as expected

I am attempting to build a C++ demo that involves multiple threads, which would necessitate the -pthread flag being passed to GCC. In order to accomplish this, I followed the Native documentation to produce the following build.gradle:

plugins {
    id 'cpp-application'

model {
    binaries {
        all {
            if(toolChain in Gcc) {
                cppCompiler.args "-pthread"
                linker.args "-pthread"

The expectation is that -pthread would have been passed, however, this does not occur. Instead, as seen in this scan, the build fails with error undefined reference to 'pthread_create', indicative of the appropriate flags not passing. Additionally, the flag is not appearing in options.txt for the Linker or Compiler as expected, providing further evidence indicating the flag did not get passed.

I was able to build with gcc directly.

Is there something I’m doing wrong here? How can I resolve this?