Skip to content

Shared BuildInfo between targets #1949

Closed

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

Activity

  1. changed the title [-]Share properties between targets[/-] [+]Shared BuildInfo between targets[/+] on Apr 24, 2015
  2. added this to the milestone on Apr 24, 2015
  3. rudymatela commented on Jun 17, 2015

    @rudymatela
    ContributorAuthor

    By the way, I've seen a few posts on stackoverflow related to this issue:

  4. modified the milestones: Cabal 1.24, on Feb 21, 2016
  5. modified the milestone: Cabal 2.0 on Sep 6, 2016
  6. ulysses4ever commented on Sep 26, 2022

    @ulysses4ever
    Collaborator

    Should this be closed in the light of common stanzas? (#4751, bfb1967, possible dup of #2832)

  7. Mikolaj commented on Sep 30, 2022

    @Mikolaj
    Member

    @rudymatela: would you like to comment? Alternatively, we can close this ticket and you are very welcome to open a new one once you have the time to investigate the new cabal feature that plausibly solves this issue.

  8. rudymatela commented on Oct 3, 2022

    @rudymatela
    ContributorAuthor

    @ulysses4ever @Mikolaj I did not test the common stanzas feature, but by reading the relevant tickets (#4751, #2832) they seem to resolve this issue.

    Thanks for addressing this!

    I will close now.

  9. Mikolaj commented on Oct 17, 2022

    @Mikolaj
    Member

    Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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