
A while ago I moved a project away from using a mix of Cabal and make to build (Cabal to build the library and make to build the tests) to using only Cabal. I added a flag and then made a construct like this: flag BuildTests Description: Build unit and quickcheck tests. Default: False ... executable tests if flag(BuildTests) main-is: Test.hs build-depends: test-framework, test-framework-hunit, HUnit, test-framework-quickcheck2, QuickCheck >= 2.1.0.0 hs-source-dirs: test-src src else main-is: Test.hs buildable: False Interestingly that does work for things like 'configure' and 'build', but it doesn't work for 'sdist': % ./Setup.hs sdist Distribution quality errors: Building source dist for dataenc-0.13.0.1... Setup.hs: Test.hsTest.hs doesn't exist 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? /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe