diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 6f91d1a2d..466d3c21d 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -2004,27 +2004,26 @@ cmGeneratorTarget::UseObjectLibraries(std::vector& objs, { std::vector objectFiles; this->GetExternalObjects(objectFiles, config); - std::vector objectLibraries; + std::vector objectLibraries; for(std::vector::const_iterator it = objectFiles.begin(); it != objectFiles.end(); ++it) { std::string objLib = (*it)->GetObjectLibrary(); - if (cmTarget* tgt = this->Makefile->FindTargetToUse(objLib)) + if (cmGeneratorTarget* tgt = + this->LocalGenerator->FindGeneratorTargetToUse(objLib)) { objectLibraries.push_back(tgt); } } - std::vector::const_iterator end + std::vector::const_iterator end = cmRemoveDuplicates(objectLibraries); - for(std::vector::const_iterator + for(std::vector::const_iterator ti = objectLibraries.begin(); ti != end; ++ti) { - cmTarget* objLib = *ti; - cmGeneratorTarget* ogt = - this->GlobalGenerator->GetGeneratorTarget(objLib); + cmGeneratorTarget* ogt = *ti; std::vector objectSources; ogt->GetObjectSources(objectSources, config); for(std::vector::const_iterator