Issue with defines that target platform module

Hey, I’ve had similar problem regarding libraries, but now I’m experiencing an issue where I’m unable to define things for platform core library.

Setting:

-DCORE_DEBUG_LEVEL=0

using scons environment has no effect on core arduino library, but the define is visible elsewhere in project (even in some libraries).

See referenced issue, this is how I’m trying to handle it

The expected state is to affect platform core definitions as well.

Please take a look at https://docs.platformio.org/scripting/middlewares.html