BUG: a fix for constant recomputing of depends

This commit is contained in:
Ken Martin 2005-05-25 12:22:32 -04:00
parent 0e194cab84
commit d7cbf3e1d6
4 changed files with 17 additions and 8 deletions

View File

@ -48,6 +48,11 @@ void cmDepends::SetTargetFile(const char* dir, const char* targetFile,
m_DependsMarkFile += m_TargetFile; m_DependsMarkFile += m_TargetFile;
m_DependsMakeFile += makeExt; m_DependsMakeFile += makeExt;
m_DependsMarkFile += markExt; m_DependsMarkFile += markExt;
if (!m_CompileDirectory.size())
{
m_CompileDirectory = dir;
}
} }
@ -79,12 +84,12 @@ void cmDepends::Check()
{ {
// Dependency checks must be done in proper working directory. // Dependency checks must be done in proper working directory.
std::string oldcwd = "."; std::string oldcwd = ".";
if(m_Directory != ".") if(m_CompileDirectory != ".")
{ {
// Get the CWD but do not call CollapseFullPath because // Get the CWD but do not call CollapseFullPath because
// we only need it to cd back, and the form does not matter // we only need it to cd back, and the form does not matter
oldcwd = cmSystemTools::GetCurrentWorkingDirectory(false); oldcwd = cmSystemTools::GetCurrentWorkingDirectory(false);
cmSystemTools::ChangeDirectory(m_Directory.c_str()); cmSystemTools::ChangeDirectory(m_CompileDirectory.c_str());
} }
// Check whether dependencies must be regenerated. // Check whether dependencies must be regenerated.

View File

@ -37,6 +37,9 @@ public:
void SetTargetFile(const char* dir, const char* targetFile, void SetTargetFile(const char* dir, const char* targetFile,
const char *markExt, const char *makeExt); const char *markExt, const char *makeExt);
/** at what level will the compile be done from */
void SetCompileDirectory(const char *dir) {m_CompileDirectory = dir;};
/** should this be verbose in its output */ /** should this be verbose in its output */
void SetVerbose(bool verb) { m_Verbose = verb; } void SetVerbose(bool verb) { m_Verbose = verb; }
@ -71,6 +74,7 @@ protected:
// 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 m_Directory; std::string m_Directory;
std::string m_CompileDirectory;
// The name of the target file for which dependencies are maintained. // The name of the target file for which dependencies are maintained.
std::string m_TargetFile; std::string m_TargetFile;

View File

@ -2697,6 +2697,7 @@ cmLocalUnixMakefileGenerator3::GetDependsChecker(const std::string& lang,
if (ret) if (ret)
{ {
ret->SetTargetFile(dir, objFile, ".depend",".build.depend.make"); ret->SetTargetFile(dir, objFile, ".depend",".build.depend.make");
ret->SetCompileDirectory(m_Makefile->GetHomeOutputDirectory());
ret->SetVerbose(verbose); ret->SetVerbose(verbose);
} }
return ret; return ret;
@ -2958,8 +2959,7 @@ void cmLocalUnixMakefileGenerator3::CheckDependencies(cmMakefile* mf,
{ {
// Construct a checker for the given language. // Construct a checker for the given language.
std::auto_ptr<cmDepends> std::auto_ptr<cmDepends>
checker(cmLocalUnixMakefileGenerator3 checker(this->GetDependsChecker(*l, ".", f->c_str(), verbose));
::GetDependsChecker(*l, ".", f->c_str(), verbose));
if(checker.get()) if(checker.get())
{ {
checker->Check(); checker->Check();

View File

@ -215,7 +215,7 @@ protected:
std::string& depMarkFile); std::string& depMarkFile);
// return the appropriate depends checker // return the appropriate depends checker
static cmDepends* GetDependsChecker(const std::string& lang, cmDepends* GetDependsChecker(const std::string& lang,
const char* dir, const char* dir,
const char* objFile, const char* objFile,
bool verbose); bool verbose);