[CMake] Adding a new language

Alan W. Irwin irwin at beluga.phys.uvic.ca
Tue Nov 15 23:55:16 EST 2011


On 2011-11-15 22:13-0500 Stefan Monnier wrote:

>>> I'd still like to know how to explain to cmake that the command produces
>>> 2 files, but at least I can get rid of my hack.
>> That (assuming just a simple object file is produced by compilation)
>> is one of several general limitations with CMake language support. For
>> example, my understanding is this issue has been taken care of for
>> Fortran 95 (where compilation produces both object and module files)
>> with Fortran-95 specific changes to the C++ cmake code.  But I would far
>> prefer to see a generic mechanism for this to not only to deal with
>> the Fortran 95 module issue, but also the compilation-generated Ada
>> library identification (*.ali) files, and also the similar issue for
>> OCaml compiler generated files that you have described.
>
> Hmm...
>
>> Because of this and other struggles I had trying to implement Ada
>> language support for CMake, I didn't even consider implementing CMake
>> language support for OCaml for the PLplot OCaml bindings.  Instead we
>> currently use (many!) custom commands and targets for that case, but
>> I would be happy to change to your CMake OCaml language support
>> if/when that works.
>
> I'm trying to use CMake for a new project here.  This project (a new
> programming language, whose first implementation is in OCaml) is
> currently in the very first stages (I have barely more than the lexer
> written) and doesn't require anything sophisticated (there's only
> 1 OCaml file for now ;-).  So my "language support" is very primitive
> and rather than fight CMake, I'll probably just switch to something
> else :-(

Hi Stefan:

I am sorry that CMake support for new languages with complicated needs
is not there yet, and I completely understand why you don't want to
get involved with that general problem for your limited OCaml needs.

However, I wouldn't give up on CMake entirely because of that
constraint.  Instead, I would suggest you use the alternative of
low-level CMake custom commands and custom targets to build what you
need to build with OCaml. For a detailed example of that approach, see
http://plplot.svn.sourceforge.net/viewvc/plplot/trunk/cmake/modules/ocaml.cmake?view=log
(which sets things up for the OCaml parts of the PLplot build) ,
http://plplot.svn.sourceforge.net/viewvc/plplot/trunk/bindings/ocaml/CMakeLists.txt?view=log
(which gives examples of relevant custom commands and targets to build
the PLplot OCaml bindings), and
http://plplot.svn.sourceforge.net/viewvc/plplot/trunk/examples/ocaml/CMakeLists.txt?view=log
(which shows how we build the PLplot OCaml examples).

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list