From f698e306a7cd44e01d63924846bcb01e6c3e1733 Mon Sep 17 00:00:00 2001 From: Ken Martin Date: Thu, 5 Jun 2003 16:12:25 -0400 Subject: more changes to support full paths --- Source/cmMakefile.cxx | 49 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 8abf90e..0fe71cf 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1639,10 +1639,6 @@ cmSourceFile* cmMakefile::GetSource(const char* sourceName) const std::string sname = cmSystemTools::GetFilenameWithoutLastExtension(s); - /* unfortunately old CMakeList files sometimes use sources with providing - * their extensions. If this is the case then we must - */ - // compute the extension std::string ext; ext = cmSystemTools::GetFilenameLastExtension(s); @@ -1662,6 +1658,37 @@ cmSourceFile* cmMakefile::GetSource(const char* sourceName) const return *i; } } + + // geeze, if it wasn't found maybe it is listed under the output dir + if (!cmSystemTools::GetFilenamePath(sourceName).empty()) + { + return 0; + } + + s = this->GetCurrentOutputDirectory(); + s += "/"; + s += cmSystemTools::GetFilenameName(sourceName); + path = this->GetCurrentOutputDirectory(); + + // compute the extension + ext = cmSystemTools::GetFilenameLastExtension(s); + s = s.substr(0, s.length()-ext.length()); + if ( ext.length() && ext[0] == '.' ) + { + ext = ext.substr(1); + } + + for(std::vector::const_iterator i = m_SourceFiles.begin(); + i != m_SourceFiles.end(); ++i) + { + if ((*i)->GetSourceName() == sname && + cmSystemTools::GetFilenamePath((*i)->GetFullPath()) == path && + (ext.size() == 0 || (ext == (*i)->GetSourceExtension()))) + { + return *i; + } + } + return 0; } @@ -1684,6 +1711,20 @@ cmSourceFile* cmMakefile::GetOrCreateSource(const char* sourceName, { return ret; } + + // OK a source file object doesn't exist for the source + // maybe we made a bad call on assuming it was in the src tree + if (generated && path.empty()) + { + src = this->GetCurrentOutputDirectory(); + src += "/"; + src += cmSystemTools::GetFilenameName(sourceName); + } + ret = this->GetSource(src.c_str()); + if (ret) + { + return ret; + } // we must create one cmSourceFile file; -- cgit v0.12