diff options
author | Brad King <brad.king@kitware.com> | 2008-03-11 21:53:54 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2008-03-11 21:53:54 (GMT) |
commit | b78997d71ddd68247f021bb258f6ffd1e344057b (patch) | |
tree | 6171f9009a07c9c34fe4fb9c498de5cbfe6dc7cd | |
parent | c905bf9b13e4f0418acef1f16f9c6bf9ae2b97ed (diff) | |
download | CMake-b78997d71ddd68247f021bb258f6ffd1e344057b.zip CMake-b78997d71ddd68247f021bb258f6ffd1e344057b.tar.gz CMake-b78997d71ddd68247f021bb258f6ffd1e344057b.tar.bz2 |
BUG: Fix subtle bug that prevented Makefile generators from rescanning dependencies when a new source file is added but no other sources are touched.
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 396dd75..158a019 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -24,6 +24,7 @@ #include "cmSourceFile.h" #include "cmake.h" #include "cmVersion.h" +#include "cmFileTimeComparison.h" // Include dependency scanners for supported languages. Only the // C/C++ scanner is needed for bootstrapping CMake. @@ -1307,15 +1308,39 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo, std::string internalDependFile = dir + "/depend.internal"; std::string dependFile = dir + "/depend.make"; + // If the target DependInfo.cmake file has changed since the last + // time dependencies were scanned then force rescanning. This may + // happen when a new source file is added and CMake regenerates the + // project but no other sources were touched. + bool needRescan = false; + cmFileTimeComparison* ftc = + this->GlobalGenerator->GetCMakeInstance()->GetFileComparison(); + { + int result; + if(!ftc->FileTimeCompare(internalDependFile.c_str(), tgtInfo, &result) || + result < 0) + { + if(verbose) + { + cmOStringStream msg; + msg << "Dependee \"" << tgtInfo + << "\" is newer than depender \"" + << internalDependFile << "\"." << std::endl; + cmSystemTools::Stdout(msg.str().c_str()); + } + needRescan = true; + } + } + // Check the implicit dependencies to see if they are up to date. // The build.make file may have explicit dependencies for the object // files but these will not affect the scanning process so they need // not be considered. cmDependsC checker; checker.SetVerbose(verbose); - checker.SetFileComparison - (this->GlobalGenerator->GetCMakeInstance()->GetFileComparison()); - if(!checker.Check(dependFile.c_str(), internalDependFile.c_str())) + checker.SetFileComparison(ftc); + if(needRescan || + !checker.Check(dependFile.c_str(), internalDependFile.c_str())) { // The dependencies must be regenerated. std::string targetName = cmSystemTools::GetFilenameName(dir); |