From 2615e6f0a9ce35198d54922aedc1ab5b7f1a68c3 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Mon, 6 Dec 2004 12:38:04 -0500 Subject: BUG: fix for bug 1396, object files could not be used as sources any more --- Source/cmGlobalGenerator.cxx | 16 ++++++++++++++++ Source/cmGlobalGenerator.h | 1 + Source/cmLocalUnixMakefileGenerator.cxx | 26 ++++++++++++++++++++++++-- 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index beef256..6b02c96 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -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; } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 3b04620..89441dc 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -133,6 +133,7 @@ private: // in EnableLanguagesFromGenerator std::map m_IgnoreExtensions; std::map m_LanguageEnabled; + std::map m_OutputExtensions; std::map m_LanguageToOutputExtension; std::map m_ExtensionToLanguage; std::map m_LanguageToLinkerPreference; diff --git a/Source/cmLocalUnixMakefileGenerator.cxx b/Source/cmLocalUnixMakefileGenerator.cxx index 5b34a48..850f964 100644 --- a/Source/cmLocalUnixMakefileGenerator.cxx +++ b/Source/cmLocalUnixMakefileGenerator.cxx @@ -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 << " "; + } } } } -- cgit v0.12