On 22. Jun, 2010, at 7:27 , Magnus Therning wrote: > On Mon, Jun 21, 2010 at 17:46, Aeschbacher, Fabrice > <fabrice.aeschbac...@siemens.com> wrote: >> I would try following in foo/CmakeLists.txt: >> >> add_custom_command(TARGET foo >> POST_BUILD >> COMMAND touch bar/CMakeLists.txt >> ) >> >> This will force CMake to re-build the makefiles for 'bar' (because its >> CMakeLists.txt has been modified) >> >> And of course, add_dependencies(bar foo) > > It might, but it still feels like a rather strange way to go about it. > > I'll make yet another attempt to explain the situation, hopefully better so > that it becomes more clear what the problem is. > > There are three tools involved: > > camlp4 - an extensible pre-processor, it makes it possible to modify OCaml > and even add syntax > ocamldep - a tool that inspects a source file and tells you what it depends > on, it can be told to use a preprocessor through its -pp argument > ocamlc - the OCaml compiler, it can be told to use a preprocessor through > its -pp argument > > Somewhat simplified the project I'm converting to use CMake has two parts: > > foo - an extension to camlp4 > bar - an OCaml module, wich uses the syntax extensions implemented in foo > > So if I understand you, these would roughly be the steps I need to take: > > 1. Call 'cmake' (manual) > This must skip dependency generation for bar; foo isn't built yet and > hence ocamldep will not be able to parse the source for bar. > 2. Call 'make' (manual) > Builds foo, and as a last thing touch the CMakeLists.txt for bar. > > Now you're saying that because of the post-build step in 2 the following will > happen automatically, right? > > 3. Call to 'cmake' (automatic) > Now foo has been built so the correct dependencies for bar can be > determined. (I have yet to find out exactly *how* I can determine that > foo already is built, but that sounds like it shouldn't be too difficult.) > > 4. Call to 'make' (automatic) > Now the Makefile for bar contains the correct dependency information and > the build can continue. > > Have I understood you correctly? > > /M
Ahh, now I understand. You need foo already at cmake-time, not at make-time. Ideally you'd want to run ocamldep at make-time to determine the file-level dependencies, like cmake does for C/C++/Fortran/Java. However, I don't think there's a way to do so currently. IMHO this would be a good feature-request in the bug tracker. Michael _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake