[CMake] Adding ALL as a dependency

Nils Gladitz nilsgladitz at gmail.com
Wed Jun 11 15:05:24 EDT 2014


On 11.06.2014 20:04, Rick McGuire wrote:
> Is it possible to add the ALL set of targets as a dependency for a 
> target that is not part of the ALL set?  We have some targets for 
> building an installer that are not part of the default build, but must 
> be invoked explicitly to build the installer.  A successful installer 
> build is really dependent upon having an up-to-date build, so I'd like 
> to put in a dependency where a complete build is attempted if we're 
> building the installer.  I tried specifying ALL in the DEPENDS 
> section, but it didn't like that.  Is there a variable available that 
> contains the list of ALL targets?
>

I don't think so.
See e.g. http://public.kitware.com/Bug/view.php?id=8438.

Perhaps you could reverse it?
Since the default "install" and "package" targets depends on "all" per 
default have "all" build everything that is actually required for the 
install.

Then add a custom target (add_custom_target(subset)) and set up 
dependencies for it to all targets that make up your subset.
e.g. add_dependencies(subset foo1 foo2)

Then (assuming e.g. make) "make subset" will build that specific subset.

Nils


More information about the CMake mailing list