简体   繁体   English

在 package.yaml 中的哪里添加标志?

[英]Where to add a flag in the package.yaml?

I have a package.yaml file like:我有一个 package.yaml 文件,例如:

name: ...
version: ...

...

flags:
  strict: ...
    description: ...
    ...

dependencies:
  ...

...

Mostly typical package.yaml file.大多数是典型的package.yaml文件。 And one of the dependencies uses a library (so it's a transitive dependency) which has flags (one of them is use-pkg-config flag).其中一个依赖项使用一个库(因此它是一个传递依赖项),它有标志(其中一个是use-pkg-config标志)。

How to turn on this flag?如何打开这个标志? I tried:我试过:

pkg-config-dependencies: that-library

Also I tried to add a GHC option:我还尝试添加一个 GHC 选项:

...
ghc-options:
  ...
  -fuse-pkg-config

and to add flags: section to library: , it seems it does not work because I see in the compilation console output:并将flags: section 添加到library: ,它似乎不起作用,因为我在编译控制台 output 中看到:

......... -f-use-pkg-config ....

and not -fuse-pkg-config , so I suppose it does not work.而不是-fuse-pkg-config ,所以我想它不起作用。 How to add a flag for such dependency (it's transitive - I don't know it matters or not) in package.yaml ?如何在package.yaml中为这种依赖添加一个标志(它是可传递的 - 我不知道它是否重要)?

Flags can be specified in project-level configuration files, stack.yaml or cabal.project .可以在项目级配置文件stack.yamlcabal.project中指定标志。

-- cabal.project
package my-dependency
  flag: +use-pkg-config
# stack.yaml
flags:
  my-dependency:
    use-pkg-config: true

Documentation:文档:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM