[CMake] [cmake-developers] Obtaining header file dependencies of a source file manually

Brad King brad.king at kitware.com
Mon Nov 30 14:08:17 EST 2015


On 11/30/2015 01:56 PM, Dan Liew wrote:
> It doesn't look completely impossible. For Ninja, it looks like it has
> some support for compiler generated dependency files [2]

Yes, it may be possible for Ninja.

> There is an alternative which I suggested in the post. Have CMake
> determine the dependencies of the files passed to ``IMPLICIT_DEPENDS``
> at configure time and spit that into the build files of the generator
> (that would work for any generator). Then have any changes made to the
> files passed to ``IMPLICIT_DEPENDS`` trigger a reconfigure so that the
> dependencies can be recomputed.

Perhaps, but after regenerating the project the build tool will not
re-load the build files and start building again.  That will take
an additional invocation.  The number of iterations required is
bounded only by the depth of dependency chains.

It may be much easier to pack all this inside a separate
configure/build process using ExternalProject.

-Brad



More information about the CMake mailing list