On haskell-packages side: add an option to include CPP headers, analogous to GHC's -optP-include.
On Cabal side: pass cabal_macros.h to the compiler.
See:
Cabal/Distribution/Simple/GHC.hs:1177
Cabal/Distribution/Simple/Program/GHC.hs:309
For the background, see haskell-suite/haskell-names#51