Setting external GPR variables based on profile in Alire

I’m trying to setup Alire to specify a specific external variable based on the profile chosen by
alr build

I have a custom GPR that I want alire to use and it already has a release/development configurations of its own. So I am trying to map out the alire profiles to the custom gpr variables using a case statement, but it doesn’t like it

I got the idea from the gpr-set-externals section of Alire - Docs

NOTE: line numbers added in for clarity

15    [gpr-externals]
16    BUILD = ["release", "development"]
17    
18    [gpr-set-externals'.case(profile)']
19    release     = { BUILD = "release" }
20    development = { BUILD = "development"}
21    validation  = { BUILD = "development"}
ERROR: Cannot continue without a workspace:
ERROR:    Loading release from manifest: alire.toml:
ERROR:    Failed to load alire.toml:
ERROR:    Loading release from manifest: alire.toml:
ERROR:    gpr-set-externals:
ERROR:    values:
ERROR:    case(profile):
ERROR:    Expression variable 'profile' is unknown (distribution host-arch os toolchain word-size)

Anyone know of a way to do this? I need it such that alire users can do:
alr build
alr build --release

and non alire users can do
gprbuild
gprbuild -XBUILD=release

I need it to work in a mixed environment. That means if an alire user hops in and runs alr buid --release and then a non alire user comes in later and tries gprbuild that it uses the correct switches.

I don’t have a validation profile in the custom GPR, so I would just map that to development for now.

Update:
I couldn’t get a solution using the TOML file figured out for this. However, I was able to emulate it in gprbuild by adding another gpr file specifically for alire that is a aggregate project wrapper around my original gpr file. Then in the alire aggregate project I specify the external based on the current alire profile in the gpr file. It’s a bit of a mess, but it works out for what I need.