[CMake] Building in stages.

Magnus Therning magnus at therning.org
Mon Jun 21 11:41:09 EDT 2010


On Mon, Jun 21, 2010 at 16:10, Michael Wild <themiwi at gmail.com> wrote:
>
>> I'm looking for some suggestions on how to tackle a problem with staged
>> builds.
>>
>> In trying to convert a project which uses omake to build OCaml files I've
>> stumbled on the issue that building one sub-part (bar) of the project needs
>> the result of another sub-part (foo).  The twist is that foo is required
>> already at the dependency-discovery stage of bar[1].  Is there some clever way
>> of working around this?
>>
>> One obvious solution would be to simply skip automatic generation of
>> dependencies for bar, but that feels a little naughty.  It feels about as
>> naughty as how the previous build system just worked by ordering[2].
>>
>> Hopefully there's some better way of achieving this, any suggestions?
>>
>> /M
>>
>> [1] For those initiated in OCaml and its tools stack the former sub-part
>> builds a custom filter for camlp4 which is then used in the latter sub-part.
>> [2] omake is very similar to make and in this case the build of foo just
>> happened before bar, and there was no attempt at automatic generation of
>> dependencies at all.
>
> Well, if you need foo to be built before bar, just use add_dependencies(bar foo). File-level dependency scanning happens just before bar is built, so if I understand your question correctly, you should be fine now...

No, I need foo to be built before bar is inspected to gather its
dependencies.  And dependencies for both foo and bar are gathered when
calling `cmake` to generate the Makefiles.  This is how my OCaml
support works at the moment.  If you have suggestions for how to move
the dependency generation to compile time (i.e. when calling `make`)
then I'd be very glad to hear it.  Or even better, be pointed to an
example of how to achieve that.

/M

-- 
Magnus Therning                        (OpenPGP: 0xAB4DFBA4)
magnus@therning.org          Jabber: magnus@therning.org
http://therning.org/magnus         identi.ca|twitter: magthe


More information about the CMake mailing list