I need to find out what flags (the type found in cabal files) are being built with in Setup.hs. I think I'm looking for something with type FlagAssignment. How can I get this?
Idris has to do this, you can see the code here. In short, read the configConfigurationsFlags
of ConfigFlags
which you can get from the configFlags
field of the LocalBuildInfo
record. LocalBuildInfo
is passed to every hook when you use defaultMainWithHooks
.
N.B. This information is just the flags passed to configure, so any of them that aren't specified won't be there, rather than having their default values. I think this is a bug, but as of Jan 2016 it's not fixed.
UPDATE October 2016: In Cabal-1.24 there is a flagAssignment
field in LocalBuildInfo
that has the flags after they're resolved by configuration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With