summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2003-06-05 20:12:25 (GMT)
committerKen Martin <ken.martin@kitware.com>2003-06-05 20:12:25 (GMT)
commitf698e306a7cd44e01d63924846bcb01e6c3e1733 (patch)
tree67f424a48d79a2db604cafb2518b9b9e8cafe135 /Source/cmMakefile.cxx
parent5c217cf83f423f7e844b026d23360072f0cfa275 (diff)
downloadCMake-f698e306a7cd44e01d63924846bcb01e6c3e1733.zip
CMake-f698e306a7cd44e01d63924846bcb01e6c3e1733.tar.gz
CMake-f698e306a7cd44e01d63924846bcb01e6c3e1733.tar.bz2
more changes to support full paths
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;