[CMake] ANN: UseOcaml.cmake
Philip Lowman
philip at yhbt.com
Mon Jan 11 01:14:54 EST 2010
On Sat, Jan 9, 2010 at 2:11 PM, Keyan <ml at pulsschlag.net> wrote:
> Hi,
>
> adapted from UseLATEX.cmake, i wrote a UseOcaml.cmake script, which can be found here:
>
> http://yars.svn.sourceforge.net/viewvc/yars/branches/yars-refactoring/modules/UseOcaml.cmake?revision=509&view=markup
>
> it is not complete yet, but it allows to easily compile ocaml-binaries in the following way:
>
> ADD_OCAML_TARGET(
> OUTPUT loc
> MAIN loc.ml
> SOURCES file_node.ml files.ml io.ml file_statistics.ml message_node.ml
> HEADERS file_node.mli files.mli io.mli file_statistics.mli message_node.mli
> LIBRARIES unix.cmxa str.cmxa extLib.cmxa
> INCLUDES /opt/local/lib/ocaml/site-lib/extlib
> )
>
> one current problem is that i cannot add multiple entries to the INCLUDES.
>
> i am happy to receive comments.
It looks like a couple of the macros don't have the OCAML_ name prefix
added to them. For example, COPY_FILE & GET_DEPENDENCIES. You should
add the prefix to them as well to prevent name collision when other
people use your code.
For the INCLUDES feature, doesn't it just get turned into a list you
can iterate on? Couldn't you just use foreach() on it and add the
"-I" argument and path argument to a separate list that gets passed to
add_custom_command()?
foreach(path ${includelist})
list(APPEND myargs "-I")
list(APPEND myargs "${path}")
endforeach()
I would also recommend making all commands lowercase so it's consistent.
--
Philip Lowman
More information about the CMake
mailing list