enabling / disabling executables by flags?

Marc Weber marco-oweber at gmx.de
Wed Oct 8 06:58:38 EDT 2008


Hi,


Can I enable/ disable executable by flags ?
eg this way:


=============  =======================================================
Name:            xxxxxxxxxxxxx
category:        web application
version:         0.0.1
Cabal-Version: >=1.2
build-type:      Simple
LICENSE: GPL
extensions: CPP
cpp-options: -DSSTRING=B.ByteString -DLSTRING=L.ByteString

Flag testing
  Default: True
  Description build testing application as well

executable     YYYYYYYYYYy
  main-is:        YYYYYYYYYYy.hs
  hs-source-dirs: src
  build-depends:   base
                  , HList
                  -- , HaXml == 1.19
                  , filepath
                  , mtl
                  , containers
                  , template-haskell
                  , directory
                  , HAppS-Server
                  , HAppS-Data
                  , HAppS-State
                  , type-level
  include-dirs: include
  extra-source-files: include/vxmldos.h
  -- strict and lazy strings beeing used

if flag(testing)
  executable     test
    main-is:        test.hs
    hs-source-dirs: test, src
    build-depends:   base
                    , HList
                    -- , HaXml == 1.19
                    , filepath
                    , mtl
                    , containers
                    , template-haskell
                    , directory
                    , HAppS-Server
                    , HAppS-Data
                    , HAppS-State
                    , type-level
    include-dirs: include
    extra-source-files: include/vxmldos.h
    -- strict and lazy strings beeing used
=============  =======================================================

By the way this results in

marc at mail: /pr/haskell/waskaufeichwo ]$ sConfigure
        bash: /home/marc/ghc69/bin/ghc-pkg: No such file or directory
        setup: 'parseField' called on a non-field. Consider this a bug.
                                                   ^^^^^^^^^^^^^^^^^^^
Don't think its harmfull

marc at mail: /pr/haskell/waskaufeichwo ]$ ./setup --version
        Cabal library version 1.5.5

Do you build test tests this way as well?

Marc



More information about the cabal-devel mailing list