BUG: fix for bug 1396, object files could not be used as sources any more

This commit is contained in:
Bill Hoffman 2004-12-06 12:38:04 -05:00
parent e3bb6683de
commit 2615e6f0a9
3 changed files with 41 additions and 2 deletions

View File

@ -330,6 +330,16 @@ const char* cmGlobalGenerator::GetLanguageOutputExtensionFromExtension(const cha
return "";
}
const char* lang = this->GetLanguageFromExtension(ext);
if(!lang || *lang == 0)
{
// if no language is found then check to see if it is already an
// ouput extension for some language. In that case it should be ignored
// and in this map, so it will not be compiled but will just be used.
if(m_OutputExtensions.count(ext))
{
return ext;
}
}
return this->GetLanguageOutputExtensionForLanguage(lang);
}
@ -362,6 +372,11 @@ void cmGlobalGenerator::SetLanguageEnabled(const char* l, cmMakefile* mf)
if(outputExtension)
{
m_LanguageToOutputExtension[l] = outputExtension;
m_OutputExtensions[outputExtension] = outputExtension;
if(outputExtension[0] == '.')
{
m_OutputExtensions[outputExtension+1] = outputExtension+1;
}
}
std::string linkerPrefVar = std::string("CMAKE_") +
@ -676,6 +691,7 @@ void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen )
this->m_IgnoreExtensions = gen->m_IgnoreExtensions;
this->m_LanguageToOutputExtension = gen->m_LanguageToOutputExtension;
this->m_LanguageToLinkerPreference = gen->m_LanguageToLinkerPreference;
this->m_OutputExtensions = gen->m_OutputExtensions;
}
//----------------------------------------------------------------------------

View File

@ -133,6 +133,7 @@ private:
// in EnableLanguagesFromGenerator
std::map<cmStdString, bool> m_IgnoreExtensions;
std::map<cmStdString, bool> m_LanguageEnabled;
std::map<cmStdString, cmStdString> m_OutputExtensions;
std::map<cmStdString, cmStdString> m_LanguageToOutputExtension;
std::map<cmStdString, cmStdString> m_ExtensionToLanguage;
std::map<cmStdString, cmStdString> m_LanguageToLinkerPreference;

View File

@ -465,6 +465,7 @@ void cmLocalUnixMakefileGenerator::OutputTargetRules(std::ostream& fout)
}
}
fout << "\n\n";
std::string outputName;
// get the classes from the source lists then add them to the groups
for(cmTargets::const_iterator l = tgts.begin();
l != tgts.end(); l++)
@ -524,7 +525,17 @@ void cmLocalUnixMakefileGenerator::OutputTargetRules(std::ostream& fout)
{
std::string ofname = (*i)->GetSourceName() + outExt;
ofname = this->CreateSafeUniqueObjectFileName(ofname.c_str());
fout << "\\\n\"" << this->ConvertToMakeTarget(ConvertToRelativeOutputPath(ofname.c_str()).c_str()) << "\" ";
outputName = this->ConvertToMakeTarget(ConvertToRelativeOutputPath(ofname.c_str()).c_str());
fout << "\\\n";
// if it already is double quoted because of spaces don't do it again.
if(outputName.size() && outputName[0] != '\"')
{
fout << "\"" << outputName << "\" ";
}
else
{
fout << outputName << " ";
}
}
}
}
@ -541,7 +552,18 @@ void cmLocalUnixMakefileGenerator::OutputTargetRules(std::ostream& fout)
(*i)->GetSourceExtension().c_str());
if(outExt.size() && (*i)->GetPropertyAsBool("EXTERNAL_OBJECT") )
{
fout << "\\\n\"" << this->ConvertToMakeTarget(ConvertToRelativeOutputPath((*i)->GetFullPath().c_str()).c_str()) << "\" ";
outputName =
this->ConvertToMakeTarget(ConvertToRelativeOutputPath((*i)->GetFullPath().c_str()).c_str());
fout << "\\\n";
// if it already is double quoted because of spaces don't do it again.
if(outputName.size() && outputName[0] != '\"')
{
fout << "\"" << outputName << "\" ";
}
else
{
fout << outputName << " ";
}
}
}
}