[cmake-developers] Ninja and add_subdirectory EXCLUDE_FROM_ALL
Charles Huet
charles.huet at gmail.com
Wed Mar 16 04:59:37 EDT 2016
> This is per-target and is different than add_subdirectory
EXCLUDE_FROM_ALL.
We should still honor this.
Ok, done.
> The rules we're generating here could work like that too. Each one
depends on all the targets defined in its own directory and on the
directory-level target for subdirectories. The goal is to match the
Makefile generator behavior for target selection in each directory.
I don't think matching subdirectory name prefixes is needed for that.
Ah, yes, this makes a lot of sense. Now I feel a bit dumb for not going
this way in the first place.
> I think the names can instead use a "/all" suffix e.g. "sub/dir/all".
This would be consistent with the "ninja all" one can now do at the
top.
Sure, done.
If you have other ideas on how to improve this patch, I'll be happy to
implement them.
I've been using Cmake 3.5 with this added feature and I must say it's
pretty sweet for my use case.
Best
Le mar. 15 mars 2016 à 18:58, Brad King <brad.king at kitware.com> a écrit :
> On 03/14/2016 05:04 AM, Charles Huet wrote:
> > I modified my patch a bit to use C++98 only, and try to stick
> > to the coding conventions.
>
> Thanks. While reviewing the logic I realized my suggestion to include
> all targets was not quite consistent with my observation that this matches
> the Makefile generator "cd dir; make" behavior. The latter still excludes
> targets that have the EXCLUDE_FROM_ALL target property, as seen by this
> code in cmGlobalUnixMakefileGenerator3::WriteDirectoryRule2:
>
> > if((!check_all || !gtarget->GetPropertyAsBool("EXCLUDE_FROM_ALL")) &&
>
> This is per-target and is different than add_subdirectory EXCLUDE_FROM_ALL.
> We should still honor this. Such targets are meant to be built only upon
> explicit request. Also later in WriteDirectoryRule2 is this section:
>
> > // The directory-level rule should depend on the directory-level
> > // rules of the subdirectories.
>
> The rules we're generating here could work like that too. Each one
> depends on all the targets defined in its own directory and on the
> directory-level target for subdirectories. The goal is to match the
> Makefile generator behavior for target selection in each directory.
> I don't think matching subdirectory name prefixes is needed for that.
>
> > These targets are prefixed with "path/" in order to set them apart of
> > normal CMake targets.
>
> I think the names can instead use a "/all" suffix e.g. "sub/dir/all".
> This would be consistent with the "ninja all" one can now do at the
> top.
>
> Thanks,
> -Brad
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20160316/6f23511e/attachment-0001.html>
More information about the cmake-developers
mailing list