Binaries.all inside a source set appears not properly scoped (2.0-rc1 and 1.12)

Create src/main/hello.cpp that behaves differently when EXTRA_CHEERY is defined. Build with the following:

apply plugin: 'cpp'
executables {
  hello
  helloCheery
}
sources {
  helloCheery {
    cpp {
      source {
        srcDir "src/hello/cpp"
      }
    }
    // affects all binaries, not just helloCheery
    binaries.all {
      cppCompiler.define 'EXTRA_CHEERY'
    }
  }
}

observe that both executables, not just helloCheery, were built with -DEXTRA_CHEERY.

This is expected, as ‘binaries.all’ refers to ‘project.binaries.all’ here. Perhaps what you want is ‘executables.helloCheery.binaries.all’.

Yes, you’re right. Thanks.