Only generate one check per missing target.

This commit is contained in:
Stephen Kelly 2013-01-13 09:42:47 +01:00 committed by Brad King
parent f623d37a95
commit d8fe1fcd80
1 changed files with 15 additions and 11 deletions

View File

@ -671,7 +671,10 @@ void cmExportFileGenerator::GenerateMissingTargetsCheckCode(std::ostream& os,
}
os << "# Make sure the targets which have been exported in some other \n"
"# export set exist.\n";
std::set<std::string> emitted;
for(unsigned int i=0; i<missingTargets.size(); ++i)
{
if (emitted.insert(missingTargets[i]).second)
{
os << "IF(NOT TARGET \"" << missingTargets[i] << "\" )\n"
<< " IF(CMAKE_FIND_PACKAGE_NAME)\n"
@ -685,6 +688,7 @@ void cmExportFileGenerator::GenerateMissingTargetsCheckCode(std::ostream& os,
<< " ENDIF()\n"
<< "ENDIF()\n";
}
}
os << "\n";
}