[cmake-developers] Ninja and add_subdirectory EXCLUDE_FROM_ALL
Charles Huet
charles.huet at gmail.com
Thu Mar 10 02:58:50 EST 2016
Hi,
I was looking into this yesterday, and it seems non-trivial as far as code
modifications go to make this happen.
But I wonder if this would even be the best way to go.
Having multiple ninja files would mean (as far as I understand) duplicating
lots of values in the sub ninja files.
I think it would be easier to just add a new target for each folder added
with 'EXCLUDE_FROM_ALL' that groups all the targets added within.
Maybe even adding such a target for each 'project', which regroups all the
targets of a project would make sense, as these are grouped as 'projects'
in MSVC, whereas a folder added with 'EXCLUDE_FROM_ALL' is added as a
'solution'.
This would make ninja easy to use in a fashion relatively similar to MSVC.
To avoid name collisions these could be suffixed with something like
'_dir', '_project' or such.
Do you think this would be a good enough solution ?
Le mer. 10 févr. 2016 à 19:47, Brad King <brad.king at kitware.com> a écrit :
> On 02/10/2016 10:57 AM, Charles Huet wrote:
> > When using Unix Makefiles (or MSVC) this causes the subfolder to contain
> > a new Makefile, allowing me to build easily the whole subdir.
> >
> > I cannot find such a facility with Ninja
>
> The Makefile generator naturally lays makefiles out with launch points
> in each directory. The Xcode generator and Visual Studio generators
> generate projects that can be loaded in the respective IDEs for each
> source directory with a project() command in its CMakeLists.txt file:
>
>
> https://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmGlobalXCodeGenerator.cxx;hb=v3.4.3#l407
>
> https://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmGlobalVisualStudio7Generator.cxx;hb=v3.4.3#l383
>
> They contain the relevant subsets of the build system needed for their
> subdirectories. Currently the Ninja generator does not have this
> feature. It may be possible to add but would take some investigation
> into how intrusive the changes would be.
>
> -Brad
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20160310/589b7fd6/attachment.html>
More information about the cmake-developers
mailing list