[CMake] Adding a new language
    Stefan Monnier 
    monnier at iro.umontreal.ca
       
    Wed Nov  9 17:00:33 EST 2011
    
    
  
I'm trying to use cmake for a project using OCaml, so I'm trying to add
support for a new language.
Among the many problems I encounter, the most pressing is the
following: the rule to build object files (CMAKE_OCaml_COMPILE_OBJECT)
seems to want a command that takes <SOURCE> and generates <OBJECT>, both
of which absolute file names.
Problems is, `ocamlc' seems to insist on sending the result to a file
name of its own choosing (basically <SOURCE> with the extension
modified).  Worse yet: it generates 2 files (a .cmo object file and
a .cmi that is similar to a header file).
The rule below "works":
set (CMAKE_OCaml_COMPILE_OBJECT
  "<CMAKE_OCaml_COMPILER> -c <SOURCE> \; mv \"$$(dirname <SOURCE>)/$$(basename <OBJECT>)\" <OBJECT>")
but it's clearly not what we want.
- How do I tell Cmake that `ocamlc' generates 2 files?
- How do I tell Cmake that `ocamlc' does not let us choose where to put
  the result?
        Stefan
    
    
More information about the CMake
mailing list