[cmake-developers] using ocaml with cmake
Alexander Neundorf
neundorf at kde.org
Sun Oct 22 09:17:57 EDT 2006
On Friday 20 October 2006 14:42, you wrote:
> Alexander Neundorf wrote:
> > in KDE we have kalzium, which uses an OCaml library.
> > We managed to get it compile, but not very nice until now.
> > OCaml comes with a tool ocamldep, which parses the ocaml source files for
> > dependencies and generates a "depend" file which can be included in a
> > Makefile.
> > How can we do the dependency checking with CMake ?
> > We could load the depend file and try to parse it in CMake.
> > Or we would have to implement an ocaml dependency parser in CMake.
> > Are there other options ?
>
> What's really missing is a way to specify custom dependency scanners for
> custom commands and new languages. The real bottleneck to this is how
> to get Visual Studio projects to do the scanning and load the
> dependencies. Currently C and C++ dependencies are automatically
> handled by the VS IDE, but there does not seem to be a way even through
> the GUI to specify dependency scanning for custom build rules.
>
> One solution would be to write a VS IDE plugin to implement support for
> a whole new "language" which is used by CMake to drive custom commands.
> This would probably be a major undertaking though.
>
> What we've done in the past is to use a hack to get the dependencies in
> place. As part of the custom command for running an ocaml rule run the
> dependency scanner along with your own custom tool to convert the output
> to a MyCustomDepends<rule-id>.cmake file. In the file write
>
> SET(MY_OCAML_DEPENDS_<rule-id>
> /path/to/dep1
> /path/to/dep2
> ...
> )
>
> Then in the CMakeLists.txt file do
>
> INCLUDE(${CMAKE_CURRENT_BINARY_DIR}/MyCustomDepends<rule-id.cmake OPTIONAL)
> ADD_CUSTOM_COMMAND(
> OUTPUT some_output
> DEPENDS explicit_dependencies ${MY_OCAML_DEPENDS_<rule-id>}
> COMMAND ocaml ...
> COMMAND ocamldep ...
> COMMAND convert-depends-to-cmake-file
> )
>
> The first time the rule will run because the output doesn't exist.
> After that CMake will re-run before the next build and include the
> dependencies.
Ok, will try that.
Maybe I can even persuade the ocaml developers to add an option to ocamldep to
generate the dependency file in cmake format :-)
Bye
Alex
--
Work: alexander.neundorf AT jenoptik.com - http://www.jenoptik-los.de
Home: neundorf AT kde.org - http://www.kde.org
alex AT neundorf.net - http://www.neundorf.net
More information about the cmake-developers
mailing list