BUG: Fix to avoid repeated calls to CollapseFullPath during dependency scanning. This addresses bug#3191.

This commit is contained in:
Brad King 2006-05-03 10:07:08 -04:00
parent 0cfda4a7f0
commit 826d238ebd
3 changed files with 13 additions and 4 deletions

View File

@ -37,6 +37,11 @@ public:
/** at what level will the compile be done from */ /** at what level will the compile be done from */
void SetCompileDirectory(const char *dir) {this->CompileDirectory = dir;}; void SetCompileDirectory(const char *dir) {this->CompileDirectory = dir;};
/** Set the full path to the top of the build tree. This is
the base path from which dependencies are referenced as
relative paths. */
void SetHomeOutputDirectory(const char *dir) {this->HomeOutputDirectory = dir;};
/** should this be verbose in its output */ /** should this be verbose in its output */
void SetVerbose(bool verb) { this->Verbose = verb; } void SetVerbose(bool verb) { this->Verbose = verb; }
@ -71,9 +76,11 @@ protected:
virtual bool CheckDependencies(std::istream& internalDepends); virtual bool CheckDependencies(std::istream& internalDepends);
// The directory in which the build rule for the target file is executed. // The directory in which the build rule for the target file is executed.
std::string Directory;
std::string CompileDirectory; std::string CompileDirectory;
// The full path to the top of the build tree.
std::string HomeOutputDirectory;
// Flag for verbose output. // Flag for verbose output.
bool Verbose; bool Verbose;
cmFileTimeComparison* FileComparison; cmFileTimeComparison* FileComparison;

View File

@ -26,7 +26,6 @@ cmDependsC::cmDependsC():
IncludePath(0), GeneratedFiles(0) IncludePath(0), GeneratedFiles(0)
{ {
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// yummy look at all those constructor arguments // yummy look at all those constructor arguments
cmDependsC::cmDependsC(std::vector<std::string> const& includes, cmDependsC::cmDependsC(std::vector<std::string> const& includes,
@ -85,6 +84,7 @@ bool cmDependsC::WriteDependencies(const char *src, const char *obj,
this->Encountered.insert(src); this->Encountered.insert(src);
std::set<cmStdString> dependencies; std::set<cmStdString> dependencies;
std::set<cmStdString> scanned; std::set<cmStdString> scanned;
while(!this->Unscanned.empty()) while(!this->Unscanned.empty())
{ {
// Get the next file to scan. // Get the next file to scan.
@ -367,9 +367,10 @@ bool cmDependsC::FileExistsOrIsGenerated(const std::string& fname,
else if(cmSystemTools::FileIsFullPath(fname.c_str())) else if(cmSystemTools::FileIsFullPath(fname.c_str()))
{ {
// The generated file may have been listed with a relative path. // The generated file may have been listed with a relative path.
std::string dir = cmSystemTools::CollapseFullPath(this->Directory.c_str()); // Note that CMAKE_GENERATED_FILES is written with a conversion
// relative to the home output directory.
std::string rname = std::string rname =
cmSystemTools::RelativePath(dir.c_str(), fname.c_str()); cmSystemTools::RelativePath(this->HomeOutputDirectory.c_str(), fname.c_str());
if(this->FileIsGenerated(rname, scanned, dependencies)) if(this->FileIsGenerated(rname, scanned, dependencies))
{ {
return true; return true;

View File

@ -1275,6 +1275,7 @@ cmLocalUnixMakefileGenerator3
includeRegexScan.c_str(), includeRegexScan.c_str(),
includeRegexComplain.c_str(), includeRegexComplain.c_str(),
generatedFiles, includeCacheFileName); generatedFiles, includeCacheFileName);
scanner->SetHomeOutputDirectory(mf->GetHomeOutputDirectory());
} }
#ifdef CMAKE_BUILD_WITH_CMAKE #ifdef CMAKE_BUILD_WITH_CMAKE
else if(lang == "Fortran") else if(lang == "Fortran")