Skip to content

Shared BuildInfo between targets #1949

Closed
@rudymatela

Description

@rudymatela

A nice feature to add would be to share properties between targets. A common thing to see (even in cabal's .cabal file):

library
  exposed-modules: Blah, Bleh
  ghc-options: -Wall -Wsomething
  default-language: Haskell 2010
  if flag(debug)
    cpp-options: -DDEBUG

Test-Suite test
  ...
  ghc-options: -Wall -Wsomething
  default-language: Haskell 2010
  if flag(debug)
    cpp-options: -DDEBUG

Executable blah
  ...
  ghc-options: -Wall -Wsomething
  default-language: Haskell 2010
  if flag(debug)
    cpp-options: -DDEBUG

It would be nice to be able to declare the 4 lines as a set of options and just reference them on the different targets. With the new .cabal looking more or less like:

Common-Properties commonflags
  ghc-options: -Wall -Wsomething
  default-language: Haskell 2010
  if flag(debug)
    cpp-options: -DDEBUG

library
  exposed-modules: Blah, Bleh
  include-properties: commonflags

Test-Suite test
  ...
  include-properties: commonflags

Executable blah
  ...
  include-properties: commonflags

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions