Control GHC build options from environment variable using Cabal (Haskell)

cabal, compilation, environment-variables, ghc, haskell

Solution

If you only have on/off flags, you should use Cabal flags.

Problem

Is it possible to build Haskell project using Cabal and control the GHC flags from environment variable? in my project.cabal file there is a section 'GHC-Options', which controlls the flags, but I would love to additional set them from command line.

Original source