[CMake] Force target to always run last?

Patrick Boettcher patrick.boettcher at posteo.de
Thu May 18 03:07:35 EDT 2017


On Wed, 17 May 2017 10:36:59 -0500
Robert Dailey <rcdailey.lists at gmail.com> wrote:

> I have a custom target that must meet the following requirements:
> 
> * It must always run, regardless of what subset of other targets are
> being built
> * It must always be the very last thing run. In parallelized builds,
> it must wait until all other targets are done building before
> starting, so that it is the very last target run, and should not run
> in parallel  with others.
> 
> Is this possible? I'm willing to use hackery if needed...
> 
> Running CMake 3.8.0. Thanks!

One way would be to create a super-project-like CMakeLists.txt which
will add your current project via ExternalProject_Add() .

Then you add your always-build-last-target to this super-CMakeLists.txt
as depending on the target created by this external-project in this
super-CMakeLists.txt .

regards,
--
Patrick.



More information about the CMake mailing list