[CMake] Adding new language - source dependencies

Petr Penzin penzin.dev at gmail.com
Sat Nov 24 03:02:05 EST 2018


Hello,

I have followed instructions in CMakeAddNewLanguage.txt [1] to add 
support for Haskell, but I am a bit stuck on detecting dependencies 
between source files. Haskell source compiles to a source file and an 
"interface file" (similar to Fortran module file), which is needed for 
compiling dependent inputs. Without the proper ordering compilation 
would fail to find included files:

[ 16%] Building Haskell object src/CMakeFiles/agave.dir/Main.hs.o

/usr/home/petr/devel/agave/src/Main.hs:6:1: error:
     Could not find module ‘Basic.Status’
     Use -v to see a list of the files searched for.
   |
6 | import Basic.Status
   | ^^^^^^^^^^^^^^^^^^^

GHC (haskell platform) has a flag to output dependency info for a list 
of files without performing a full compilation, but I am not sure how to 
use that in the build. Any pointers would be appreciated!

Files:
https://github.com/ppenzin/agave/tree/cmake/cmake
https://github.com/ppenzin/agave/blob/cmake/src/CMakeLists.txt

Best,
Petr

[1]: 
https://github.com/Kitware/CMake/blob/master/Modules/CMakeAddNewLanguage.txt


More information about the CMake mailing list