BUG: fix segfault when trying to get the object file for a sourcefile in an

unknown language via GET_TARGET_PROPERTY(), as reported by Trevor Kellaway

Alex
This commit is contained in:
Alexander Neundorf 2007-05-15 16:06:18 -04:00
parent 93b94ce443
commit 4b33244ea5
1 changed files with 15 additions and 12 deletions

View File

@ -1303,21 +1303,24 @@ void cmTarget::ComputeObjectFiles()
const char* lang = this->Makefile->GetLocalGenerator()->
GetGlobalGenerator()->
GetLanguageFromExtension(sf->GetSourceExtension().c_str());
std::string lookupObj = objExtensionLookup1 + lang;
lookupObj += objExtensionLookup2;
const char* obj = this->Makefile->GetDefinition(lookupObj.c_str());
if(obj)
if (lang)
{
if(objectFiles.size())
std::string lookupObj = objExtensionLookup1 + lang;
lookupObj += objExtensionLookup2;
const char* obj = this->Makefile->GetDefinition(lookupObj.c_str());
if(obj)
{
objectFiles += ";";
if(objectFiles.size())
{
objectFiles += ";";
}
std::string objFile = *d;
objFile += "/";
objFile += this->Makefile->GetLocalGenerator()->
GetSourceObjectName(*sf);
objFile += obj;
objectFiles += objFile;
}
std::string objFile = *d;
objFile += "/";
objFile += this->Makefile->GetLocalGenerator()->
GetSourceObjectName(*sf);
objFile += obj;
objectFiles += objFile;
}
}
}