On Mon, Dec 12, 2011 at 6:25 PM, Matthew Farkas-Dyck
<[email protected]> wrote:
> I have written some code that can be compiled with either of two
> libraries, with no modification. How can I tell Cabal?
>
> I tried "||" but it failed to parse.
>
> I could find which package is available in the build script, and then
> call defaultMainNoRead with the appropriate GenericPackageDescription,
> but I'm not sure how to find this system-agnostically.

You just need to use flags.  Something like

Flag usethis
  Description:  Use this instead of that
  Default:  False

Library
  Build-depends: ...everything else...
  if flag(usethis)
    Build-depends: this == 0.1.*
  else
    Build-depends: that == 4.0.*

You don't need to care about usethis.  If 'that' is not installed but
'this' is, Cabal will automatically turn 'usethis' flag on.

Cheers,

-- 
Felipe.

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to