[Haskell-cafe] CABAL: conditional executable?

Magnus Therning magnus at therning.org
Tue Mar 4 03:10:04 EST 2008

I'm putting together a package consisting of 2 executables. Only one of
them is pure Haskell and thus buildable on all platforms, the other
relies on Windows API calls and can only be built on that platform.  I
found the “if os(...)” conditional in the CABAL docs but I'm having
problems getting it to do what I want.

if os(mingw32)
  executable foo

Results in the error “Section expected”.  Swapping the two lines like this

executable foo
  if os(mingw32)

results in “Setup.hs: Error: No 'Main-Is' field found for executable foo”.

Is there a way to get CABAL to do what I want or should I raise a
feature request on the CABAL trac?


Magnus Therning                             (OpenPGP: 0xAB4DFBA4)
magnus@therning.org             Jabber: magnus.therning@gmail.com

What if I don't want to obey the laws? Do they throw me in jail with
the other bad monads?
     -- Daveman

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20080304/6486e72f/signature.bin

More information about the Haskell-Cafe mailing list