From 73d5fd31ab1fe62956b7f2ae8ffffeb3a7281708 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 27 May 2008 13:10:09 -0400 Subject: 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. --- Source/cmSourceFile.cxx | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 0a848f6..3ee3708 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -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"; -- cgit v0.12