[CMake] OBJECT_DEPENDS and target-level dependency.

Óscar Fuentes ofv at wanadoo.es
Sun Aug 16 16:40:13 EDT 2009


Tyler Roscoe <tyler at cryptio.net> writes:

> On Sun, Aug 16, 2009 at 09:18:31PM +0200, Óscar Fuentes wrote:
>> No, that's right, although the best thing would be to create a
>> dependency on the generated files of libParent instead of on libParent
>> itself, but as the project is quite large, it doesn't impact parallel
>> builds too much.
>
> Ok now I'm curious: why would a dependency on the generated files
> themselves be the "best thing"? You could still do it that way, though
> it's more work and I do not yet see any benefit.

If the source files on the libChild depended on the generated files
alone instead of the entire libParent, they could be built as soon as
the generated files are delivered, instead of waiting for libParent.

The generation of those files are grouped into a custom target. There is
a dependency of libParent on that custom target. I guess that creating a
depedency of libChild on the custom target would do the trick.

The important info of this thread to me is that you don't need
OBJECT_DEPENDS for creating dependencies on generated files. Just create
a dependency of the library or executable on the custom target that
triggers the generation of the files. The sources will not be compiled
until the custom target is finished.

-- 
Óscar



More information about the CMake mailing list