summaryrefslogtreecommitdiff
path: root/Source/cmComputeTargetDepends.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2011-08-04 15:35:59 -0400
committerBrad King <brad.king@kitware.com>2011-08-04 15:36:32 -0400
commit8ee9bbbd0ca5aab5bceb2dc9dda041e5745ffc19 (patch)
tree4ff0c6cb4b2f62eed78a7cfe3500705c1c9e6a93 /Source/cmComputeTargetDepends.cxx
parente01cce28694201342adc97825982ed66fc52af65 (diff)
downloadcmake-8ee9bbbd0ca5aab5bceb2dc9dda041e5745ffc19.tar.gz
Do not crash when an imported target depends on a missing target
Commit e01cce28 (Allow add_dependencies() on imported targets, 2010-11-19) forgot to check if the dependee exists before using it.
Diffstat (limited to 'Source/cmComputeTargetDepends.cxx')
-rw-r--r--Source/cmComputeTargetDepends.cxx8
1 files changed, 5 insertions, 3 deletions
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index a4ca363a87..3a0ed06406 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -276,9 +276,11 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
for(std::set<cmStdString>::const_iterator i = utils.begin();
i != utils.end(); ++i)
{
- cmTarget* transitive_dependee =
- dependee->GetMakefile()->FindTargetToUse(i->c_str());
- this->AddTargetDepend(depender_index, transitive_dependee, false);
+ if(cmTarget* transitive_dependee =
+ dependee->GetMakefile()->FindTargetToUse(i->c_str()))
+ {
+ this->AddTargetDepend(depender_index, transitive_dependee, false);
+ }
}
}
else