summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-01-13 08:42:47 (GMT)
committerBrad King <brad.king@kitware.com>2013-01-15 19:36:21 (GMT)
commitd8fe1fcd800e622209fdb84f1302822e8bee5a77 (patch)
tree9373ef925b55842963b70d51c3598797fff7d4e2
parentf623d37a9558336af208a4fb5db232b28b56cb82 (diff)
downloadCMake-d8fe1fcd800e622209fdb84f1302822e8bee5a77.zip
CMake-d8fe1fcd800e622209fdb84f1302822e8bee5a77.tar.gz
CMake-d8fe1fcd800e622209fdb84f1302822e8bee5a77.tar.bz2
Only generate one check per missing target.
-rw-r--r--Source/cmExportFileGenerator.cxx26
1 files changed, 15 insertions, 11 deletions
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 91de200..a2d6961 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -671,19 +671,23 @@ 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)
{
- os << "IF(NOT TARGET \"" << missingTargets[i] << "\" )\n"
- << " IF(CMAKE_FIND_PACKAGE_NAME)\n"
- << " SET( ${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)\n"
- << " SET( ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "
- << "\"Required imported target \\\"" << missingTargets[i]
- << "\\\" not found ! \")\n"
- << " ELSE()\n"
- << " MESSAGE(FATAL_ERROR \"Required imported target \\\""
- << missingTargets[i] << "\\\" not found ! \")\n"
- << " ENDIF()\n"
- << "ENDIF()\n";
+ if (emitted.insert(missingTargets[i]).second)
+ {
+ os << "IF(NOT TARGET \"" << missingTargets[i] << "\" )\n"
+ << " IF(CMAKE_FIND_PACKAGE_NAME)\n"
+ << " SET( ${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)\n"
+ << " SET( ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "
+ << "\"Required imported target \\\"" << missingTargets[i]
+ << "\\\" not found ! \")\n"
+ << " ELSE()\n"
+ << " MESSAGE(FATAL_ERROR \"Required imported target \\\""
+ << missingTargets[i] << "\\\" not found ! \")\n"
+ << " ENDIF()\n"
+ << "ENDIF()\n";
+ }
}
os << "\n";
}