Possible to use env name as a build_flag define?

I’m hoping to simplify my platformio.ini config and not have to hardcode build_flag variables. Is there a way I can extract the name of the selected environment at build time? For example:

platform = espressif8266
framework = arduino
build_flags = ‘-DPROJECT="$env"’

I’d like to use the environment name as the PROJECT define.


See platformio-core/main.py at develop · platformio/platformio-core · GitHub

Thanks! To properly pass it as a string, I had to use: