Fix dependency tracing of INSTALL and PACKAGE (#11598)

Commit e01cce28 (Allow add_dependencies() on imported targets,
2010-11-19) started using cmMakefile::FindTargetToUse to follow
dependencies, including those of GLOBAL_TARGETs like INSTALL and
PACKAGE.  Since global targets exist in every directory, dependencies
between them must be traced within each directory too.

Teach FindTargetToUse to check the current directory before checking
globally.  For global targets this will find the local copy.  For for
normal targets this will be a no-op because they are globally unique.
This commit is contained in:
Brad King 2010-12-13 11:26:53 -05:00
parent e01cce2869
commit 0621362668
1 changed files with 6 additions and 0 deletions

View File

@ -3590,6 +3590,12 @@ cmTarget* cmMakefile::FindTargetToUse(const char* name)
return imported->second; return imported->second;
} }
// Look for a target built in this directory.
if(cmTarget* t = this->FindTarget(name))
{
return t;
}
// Look for a target built in this project. // Look for a target built in this project.
return this->LocalGenerator->GetGlobalGenerator()->FindTarget(0, name); return this->LocalGenerator->GetGlobalGenerator()->FindTarget(0, name);
} }