diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ac8381cc9b..360b3d91d0 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4061,8 +4061,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; } //----------------------------------------------------------------------------