Is it possible to use cmake for Haskell projects?

后端 未结 4 2202
失恋的感觉
失恋的感觉 2021-02-13 17:11

I am planning a project written in Haskell, maybe there are some parts in C as well. For the buildsystem I decided against the common choice for Haskell programs cabal, mainly b

4条回答
  •  逝去的感伤
    2021-02-13 17:36

    While you certainly can build Haskell code directly by using a general purpose build tool, the result is much more difficult to maintain, much more difficult to share with the community and harder to build on top of than when you build on top of Cabal.

    For the buildsystem I decided against the common choice for Haskell programs cabal, mainly because I want to learn how building programs in other languages works.

    I understand the intention behind this statement in that you want to see all of the individual steps of the build process, but read another way, by avoiding cabal, you aren't seeing how programs in Haskell are built, you are seeing how painful it is to rebuild the tools provided by the community.

    I would recommend doing what Don proposed. Look at the output of cabal -v for building under your particular compiler (probably ghc) and replicating those steps in CMake.

    But then, once you understand the steps, I'd seriously consider taking that knowledge and moving back to Cabal. If only to let it deal with the issues of supporting multiple compilers, platforms, package management, etc. Thereby reducing the fragility of your build system, and making it easier to package up and share your work.

    To wit, I can't think of a single non-Cabal-built package or binary in active use by the community other than ghc itself.

    I do, however, wish you luck on your journey into the bowels of the build process!

提交回复
热议问题