summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2006-05-04 21:54:31 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2006-05-04 21:54:31 (GMT)
commita468872ccdcdfda09ef7eb6c69a8d058b55eec8c (patch)
tree55e464666f5a0bde7eb9ee6e6460472eaf7a8803 /Source/cmMakefile.cxx
parentd5d15253399ff786809b24ac659f8cb818786179 (diff)
downloadCMake-a468872ccdcdfda09ef7eb6c69a8d058b55eec8c.zip
CMake-a468872ccdcdfda09ef7eb6c69a8d058b55eec8c.tar.gz
CMake-a468872ccdcdfda09ef7eb6c69a8d058b55eec8c.tar.bz2
ENH: add a check to make sure targets only link to libraries and not utility targets to avoid seg faults, bug 3194
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 5140b74..55f9ed5 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -804,6 +804,21 @@ void cmMakefile::AddLinkLibraryForTarget(const char *target,
cmTargets::iterator i = this->Targets.find(target);
if ( i != this->Targets.end())
{
+ cmTarget* tgt =
+ this->GetCMakeInstance()->GetGlobalGenerator()->FindTarget(0, lib);
+ if(tgt)
+ {
+ // if it is not a static or shared library then you can not link to it
+ if(!((tgt->GetType() == cmTarget::STATIC_LIBRARY) ||
+ (tgt->GetType() == cmTarget::SHARED_LIBRARY)))
+ {
+ cmOStringStream e;
+ e << "Attempt to add link library " << lib
+ << " which is not a library target to target " << tgt->GetType() << " " <<
+ target << "\n";
+ cmSystemTools::Error(e.str().c_str());
+ }
+ }
i->second.AddLinkLibrary( *this, target, lib, llt );
}
else