在未安装的 Cabal 中定义可执行文件

Defining an Executable in Cabal that is Not Installed

是否有 executable 的 cabal 属性表示 "don't install this executable"。

例如在 myproject.cabal 我会:

executable install_exe
   ...
executable support_exe -- not to be installed via cabal install
   install: False

编辑:我知道我可以 可能 可以从命令行说一些东西来得到那个,但我正在寻找可以在 cabal 中默认的东西文件。

谢谢!

您可以在 executable 节中使用 buildable: False 来指示 cabal 不要构建 support_exe。如果你想在某些情况下启用它,你可以用构建标志保护这个子句。下面是一个不完整的示例。

flag support
    description: Build and install supporting executables
    default: False

executable support_exe
    if !flag(support)
        buildable: False