Cabal: conditionally override default flag value

Is there a way to rewrite:

flag llvm
    description: compile via LLVM
    default    : if os(mingw32)
                   False
                 else
                   True

or

flag llvm
    description: compile via LLVM
    default    : True

if os(mingw32)
    ?SET-LLVM=False?

and get cabalto work with it?


Note:

Further in the same file the flag is llvmused as:

if flag(llvm)
  ghc-options: -fllvm -optlo-O3

and there are many other single high-level flags that translate into multiple entries ghc-options, for example static- -static -optl-static.

+3
source share
1 answer

You can do something like this:

flag llvm
    description: compile via LLVM
    default    : True

-- ...

Executable foo
    if flag(llvm) && !os(windows)
        ghc-options: -fllvm -optlo-O3
+3
source

All Articles