[Haskell-cafe] Conditional compilation for different versions of GHC?
Jason Dagit
dagit at codersbase.com
Wed Dec 1 01:59:38 CET 2010
On Sat, Nov 27, 2010 at 9:59 AM, Jinjing Wang <nfjinjing at gmail.com> wrote:
> Thanks Michael,
>
> So the user should use `cabal install --flags -ghc7 package-name` to
> install the package, if I'm not mistaken?
>
> Will it work if the package is installed as a dependency? Will the
> flag environment be passed down from the root package?
>
> Is there a way to detect GHC version automatically?
>
I see that others have provided answers on here, but another way is to
change the check from:
if flag(ghc7)
build-depends: base >= 4.3 && < 5
cpp-options: -DGHC7
else
build-depends: base >= 4 && < 4.3
to this:
if impl(ghc >= 7)
build-depends: base >= 4.3 && < 5
cpp-options: -DGHC7
else
build-depends: base >= 4 && < 4.3
I hope that helps,
Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20101130/6a0b2a11/attachment.htm>
More information about the Haskell-Cafe
mailing list