AFAIK, with Cabal you can currently only specify program options in the configuration file or via the command line, but not in a .cabal
file.
There's an open issue about this: https://github.com/haskell/cabal/issues/1223
However, looking at the sources for Cabal
, I find that your particular problem seems to be solved by default. In Distribution.Simple.PreProcess
, there's:
ppAlex :: BuildInfo -> LocalBuildInfo -> PreProcessor
ppAlex _ lbi = pp { platformIndependent = True }
where pp = standardPP lbi alexProgram (hcFlags hc)
hc = compilerFlavor (compiler lbi)
hcFlags GHC = ["-g"]
hcFlags _ = []
This means that if Cabal is used with GHC, then -g
is automatically passed to Alex when it's being used as a preprocessor.