summaryrefslogtreecommitdiffstats
path: root/Source/cmSourceFileLocation.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2008-07-25 22:00:47 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2008-07-25 22:00:47 (GMT)
commita4b30b8b25038bd1bb2262eaf3afc582982dd230 (patch)
tree5d2b4d898095cbeee5765c4f27dc1c7485feded5 /Source/cmSourceFileLocation.cxx
parent1782d90338d248c0315ba3283968d15bc42d5427 (diff)
downloadCMake-a4b30b8b25038bd1bb2262eaf3afc582982dd230.zip
CMake-a4b30b8b25038bd1bb2262eaf3afc582982dd230.tar.gz
CMake-a4b30b8b25038bd1bb2262eaf3afc582982dd230.tar.bz2
BUG: fix source file extension bug that broke Second life build
Diffstat (limited to 'Source/cmSourceFileLocation.cxx')
-rw-r--r--Source/cmSourceFileLocation.cxx30
1 files changed, 30 insertions, 0 deletions
diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx
index ad2f40c..274c0ed 100644
--- a/Source/cmSourceFileLocation.cxx
+++ b/Source/cmSourceFileLocation.cxx
@@ -100,6 +100,36 @@ void cmSourceFileLocation::UpdateExtension(const char* name)
this->Name = cmSystemTools::GetFilenameName(name);
this->AmbiguousExtension = false;
}
+ else
+ {
+ // This is not a known extension. See if the file exists on disk as
+ // named.
+ std::string tryPath;
+ if(this->AmbiguousDirectory)
+ {
+ // Check the source tree only because a file in the build tree should
+ // be specified by full path at least once. We do not want this
+ // detection to depend on whether the project has already been built.
+ tryPath = this->Makefile->GetCurrentDirectory();
+ tryPath += "/";
+ }
+ tryPath += this->Directory;
+ tryPath += "/";
+ tryPath += this->Name;
+ if(cmSystemTools::FileExists(tryPath.c_str(), true))
+ {
+ // We found a source file named by the user on disk. Trust it's
+ // extension.
+ this->Name = cmSystemTools::GetFilenameName(name);
+ this->AmbiguousExtension = false;
+
+ // If the directory was ambiguous, it isn't anymore.
+ if(this->AmbiguousDirectory)
+ {
+ this->DirectoryUseSource();
+ }
+ }
+ }
}
//----------------------------------------------------------------------------