From 0278989405eea53ca7e5f1bfa6af9aea7a0b49c5 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 5 Aug 2016 15:55:32 -0400 Subject: Ninja: Add `$subdir/{test,install,package}` targets With the Makefile generator one can use `cd $subdir; make install` to build and install targets associated with a given subdirectory. This is not possible to do with the Ninja generator since there is only one `build.ninja` file at the top of the build tree. However, we can approximate it by allowing one to run `ninja $subdir/install` at the top of the tree to build the targets in the corresponding subdirectory and install them. This also makes sense for `test`, `package`, and other GLOBAL_TARGET targets. It was already done for `all` by commit v3.6.0-rc1~240^2~2 (Ninja: Add `$subdir/all` targets, 2016-03-11). --- Source/cmNinjaTargetGenerator.cxx | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'Source/cmNinjaTargetGenerator.cxx') diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 1466f8ac10..9030e05bb0 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -38,19 +38,8 @@ cmNinjaTargetGenerator* cmNinjaTargetGenerator::New(cmGeneratorTarget* target) return new cmNinjaNormalTargetGenerator(target); case cmState::UTILITY: + case cmState::GLOBAL_TARGET: return new cmNinjaUtilityTargetGenerator(target); - ; - - case cmState::GLOBAL_TARGET: { - // We only want to process global targets that live in the home - // (i.e. top-level) directory. CMake creates copies of these targets - // in every directory, which we don't need. - if (strcmp(target->GetLocalGenerator()->GetCurrentSourceDirectory(), - target->GetLocalGenerator()->GetSourceDirectory()) == 0) { - return new cmNinjaUtilityTargetGenerator(target); - } - // else fallthrough - } default: return CM_NULLPTR; -- cgit v1.2.1