Only generate one check per missing target.
This commit is contained in:
parent
f623d37a95
commit
d8fe1fcd80
|
@ -671,19 +671,23 @@ void cmExportFileGenerator::GenerateMissingTargetsCheckCode(std::ostream& os,
|
||||||
}
|
}
|
||||||
os << "# Make sure the targets which have been exported in some other \n"
|
os << "# Make sure the targets which have been exported in some other \n"
|
||||||
"# export set exist.\n";
|
"# export set exist.\n";
|
||||||
|
std::set<std::string> emitted;
|
||||||
for(unsigned int i=0; i<missingTargets.size(); ++i)
|
for(unsigned int i=0; i<missingTargets.size(); ++i)
|
||||||
{
|
{
|
||||||
os << "IF(NOT TARGET \"" << missingTargets[i] << "\" )\n"
|
if (emitted.insert(missingTargets[i]).second)
|
||||||
<< " IF(CMAKE_FIND_PACKAGE_NAME)\n"
|
{
|
||||||
<< " SET( ${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)\n"
|
os << "IF(NOT TARGET \"" << missingTargets[i] << "\" )\n"
|
||||||
<< " SET( ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "
|
<< " IF(CMAKE_FIND_PACKAGE_NAME)\n"
|
||||||
<< "\"Required imported target \\\"" << missingTargets[i]
|
<< " SET( ${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)\n"
|
||||||
<< "\\\" not found ! \")\n"
|
<< " SET( ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "
|
||||||
<< " ELSE()\n"
|
<< "\"Required imported target \\\"" << missingTargets[i]
|
||||||
<< " MESSAGE(FATAL_ERROR \"Required imported target \\\""
|
<< "\\\" not found ! \")\n"
|
||||||
<< missingTargets[i] << "\\\" not found ! \")\n"
|
<< " ELSE()\n"
|
||||||
<< " ENDIF()\n"
|
<< " MESSAGE(FATAL_ERROR \"Required imported target \\\""
|
||||||
<< "ENDIF()\n";
|
<< missingTargets[i] << "\\\" not found ! \")\n"
|
||||||
|
<< " ENDIF()\n"
|
||||||
|
<< "ENDIF()\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
os << "\n";
|
os << "\n";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue