Eric Seidel
Eric Seidel

Reputation: 2871

How to access custom cabal flags inside Setup.hs

I would like to use a custom cabal flag to enable some logic inside my Setup.hs, i.e. if I run cabal install -ffoo I would like to see that foo was enabled in my hook. I am, for reference, using the Custom build-type.

I expected I might find this in the configConfigurationsFlags field of the ConfigFlags, but that field is invariably empty when I run cabal. Are the values of custom flags stored elsewhere, or should I be taking a completely different approach here?

Upvotes: 0

Views: 261

Answers (1)

Eric Seidel
Eric Seidel

Reputation: 2871

It turns out using configConfigurationsFlags does work, I had just accidentally nested my Flag block inside an Executable. Moving the Flag to the top-level of the cabal file fixes everything.

Upvotes: 1

Related Questions