summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx49
1 files 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<cmSourceFile*>::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;