Hi,
I'm bringing up an old thread, because it's very relevant to my problem.
On Tue, 2008-11-18 at 01:48 -0800, Jason Dusek wrote:It is possible, in two different ways.
> I'd like to be able to do something like:
>
> if (template-haskell < 2.3)
> cpp-options: -D TH_THE_YOUNGER
> else
> cpp-options: -D TH_THE_ELDER
>
> I guess this kind of thing is not possible at present?
The easiest way is that if you're using Cabal-1.6 then it provides cpp
macros to test the version number of packages you're using.
#if MIN_VERSION_template_haskell(2,3,0)
...
#elseif
...
#endif
The alternative that works back to Cabal-1.2 is to use:
flag newer-th
...
if flag(newer-th)
build-depends: template-haskell >= 2.3
cpp-options: -D TH_THE_ELDER
else
build-depends: template-haskell < 2.3
cpp-options: -D TH_THE_YOUNGER