I'm working on a project that's chosen CMake as its build tool. The project is made up of several executables and since a few months back a few of them are written in Haskell. We strongly wish all executables to show the same version number when called as foo --version
. Ideally that version should be recorded in one place, and ideally that place should be the top-level CMakeLists.txt
(this is where the source for all the other executables get it, via the use of CMake's configure_file
function).
Is there some nice way of achieving this?
Some extra information that might be useful:
- The source for each executable lives in its own dir, with its own Cabal file.
- We use
stack
to build, and there is a singlestack.yaml
file that points to all directories with Haskell code.