To make this work I had to move the 'main-is' outside of the if-else:
executable tests
main-is: Test.hs
hs-source-dirs: test-src src
if flag(BuildTests)
build-depends: test-framework, test-framework-hunit, HUnit,
test-framework-quickcheck2, QuickCheck >= 2.1.0.0
else
buildable: False
I found this surprising, so I'm tempted to call it a bug. A quick
search didn't tell me whether this is well-known already, hence the
email. Would you consider it a bug? Has it been raised already?
if flag(test)
build-depends: QuickCheck >= 2.1 && < 2.2,
HUnit >= 1.2 && < 1.3
else
buildable: False