[cmake-developers] Ninja and add_subdirectory EXCLUDE_FROM_ALL

Brad King brad.king at kitware.com
Fri Mar 11 10:57:57 EST 2016


On 03/11/2016 10:48 AM, Charles Huet wrote:
> Here is a prototype that adds a target for each folder the
> has the EXCLUDE_FROM_ALL property set.

Is there any reason to limit this to EXCLUDE_FROM_ALL?  Why not
have a target for every directory with a CMakeLists.txt file?

> I am not satisfied with the way I exclude some build targets,
> but I could not find the correct way to do it (Install target and such).

See cmGlobalUnixMakefileGenerator3::WriteDirectoryRule2 and
its call sites for how the Makefile generator decides which
targets are part of "all" for each directory.  These targets
in build.ninja should be equivalent to "cd dir; make" in the
Makefile generator.

> I used C++11, but I don't know if this is OK in CMake, I'll refactor if not.

Please use C++98.

Thanks!
-Brad



More information about the cmake-developers mailing list