在cabal文件中的标志 [英] Flags in cabal files

查看:106
本文介绍了在cabal文件中的标志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注包开发的用户指南: https ://www.haskell.org/cabal/users-guide/developing-packages.html#quickstart

I am following the user-guide for package developing: https://www.haskell.org/cabal/users-guide/developing-packages.html#quickstart

我陷入了标志部分。我如何将标志传递给我的文件?它只是在构建时间?我试图搜索它,但没有找到有用的信息 - 只是命令选项 - flags

I got stuck in the Flags section. How do I pass flags to my files? Is it just at build time? I have tried to search for it, but found no useful information - just the command option --flags.

cabal build -f debug 不起作用

cabal build -f debug doesn't work

Flag Debug
    Description: Enable debug support
    Manual: True
    Default: False

BenchMark bench-foo
    ghc-options:        -Wall
    type:               exitcode-stdio-1.0
    default-language:   Haskell2010
    build-depends:      base, time
    main-is:            bench-foo.hs
    if flag(debug) && os(windows)
        main-is:        bench-bar.hs


推荐答案

将标志传递给 cabal configure ,例如:

Pass the flags to cabal configure, e.g.:

cabal configure -f debug

这篇关于在cabal文件中的标志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆