[Haskell-cafe] How to define CPP macro definition with stack?

Vanessa McHale vanessa.mchale at iohk.io
Wed Jun 20 10:13:28 UTC 2018


You'll need to change the `cpp-options` field in your .cabal file. You
can do this conditionally by using a cabal flag.


On 06/20/2018 02:16 AM, PY wrote:
> Hello all,
>
> I'm using conditional compilation:
>
> #ifdef BLAH
>   blahBlah
>   #endif
>
> And I want to define BLAH, but not in *.hs file. For example, with
> `stack` option or as environment variable... How can I do it? For
> example, `stack -DBLAH=1 build` or something else.
> I tried
>
>   stack build --flag='*:BLAH'
>
> - no effect.
>
> Also I tried
>
>   stack build --flag=my-library:BLAH
>
> and get error that my-library package does not define flag BLAH. So,
> it's total secret for me how to make such thing (like we can do with
> gcc, make, etc)  :-)
>
> ===
>
> Best regards, Paul
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20180620/d5f142f6/attachment-0001.sig>


More information about the Haskell-Cafe mailing list