diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index e073f769a..989aa5f83 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4086,8 +4086,11 @@ bool cmMakefile::IsAlias(const char *name) //---------------------------------------------------------------------------- cmGeneratorTarget* cmMakefile::FindGeneratorTargetToUse(const char* name) { - cmTarget *t = this->FindTargetToUse(name); - return this->LocalGenerator->GetGlobalGenerator()->GetGeneratorTarget(t); + if (cmTarget *t = this->FindTargetToUse(name)) + { + return this->LocalGenerator->GetGlobalGenerator()->GetGeneratorTarget(t); + } + return 0; } //----------------------------------------------------------------------------