ENH: Catch missing source files specified by full path earlier.

- Revert previous change to trust user-provided full paths.
  - Instead trust them only far enough to determine the source language
    but still check for existence for non-generated sources.
This commit is contained in:
Brad King 2008-05-27 13:10:09 -04:00
parent 1c0ffdc11c
commit 73d5fd31ab
1 changed files with 7 additions and 11 deletions

View File

@ -55,7 +55,13 @@ const char* cmSourceFile::GetLanguage()
// Perform computation needed to get the language if necessary.
if(this->FullPath.empty() && this->Language.empty())
{
if(this->Location.ExtensionIsAmbiguous())
// If a known extension is given or a known full path is given
// then trust that the current extension is sufficient to
// determine the language. This will fail only if the user
// specifies a full path to the source but leaves off the
// extension, which is kind of weird.
if(this->Location.ExtensionIsAmbiguous() &&
this->Location.DirectoryIsAmbiguous())
{
// Finalize the file location to get the extension and set the
// language.
@ -185,16 +191,6 @@ bool cmSourceFile::FindFullPath()
}
}
// If the user provided a full path, trust it. If the file is not
// there the native tool will complain at build time.
if(!this->Location.DirectoryIsAmbiguous())
{
this->FullPath = this->Location.GetDirectory();
this->FullPath += "/";
this->FullPath += this->Location.GetName();
return true;
}
cmOStringStream e;
e << "Cannot find source file \"" << this->Location.GetName() << "\"";
e << ". Tried extensions";