[Haskell-cafe] passing cpp options to c2hs from cabal

Chris Casinghino chris.casinghino at gmail.com
Sat Feb 27 15:27:27 EST 2010


Hi all,

I have a question about cpp, c2hs and cabal.  The short version:

What can I put in my cabal file to get "-cppopts=-U__BLOCKS__" passed
as an argument in calls to c2hs?

Longer story:

I need to set up my cabal file so that c2hs gets this extra option to
make things build smoothly on some macs.  If I run cabal from the
command line, I can pass it:

cabal install --c2hs-options='--cppopts=-U__BLOCKS__'

And this works great.  I need to make my .cabal file do this, but
c2hs-options doesn't seem to be accepted there.  I tried:

cpp-options:  "-U__BLOCKS__"

But if I run cabal install -v I can see this isn't being passed on to
c2hs:

...
/home/ccasin/.cabal/bin/c2hs --include=dist/build
--cppopts=-D__GLASGOW_HASKELL__=610 --cppopts=-Icontrib/libpuz/include
--output-dir=dist/build --output=Codec/Game/Puz/Internal.hs
./Codec/Game/Puz/Internal.chs
...

Thanks!

--Chris Casinghino


More information about the Haskell-Cafe mailing list