Commit b78997d7 authored by Brad King's avatar Brad King
Browse files

BUG: Fix subtle bug that prevented Makefile generators from rescanning...

BUG: Fix subtle bug that prevented Makefile generators from rescanning dependencies when a new source file is added but no other sources are touched.
parent c905bf9b
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "cmSourceFile.h" #include "cmSourceFile.h"
#include "cmake.h" #include "cmake.h"
#include "cmVersion.h" #include "cmVersion.h"
#include "cmFileTimeComparison.h"
// Include dependency scanners for supported languages. Only the // Include dependency scanners for supported languages. Only the
// C/C++ scanner is needed for bootstrapping CMake. // C/C++ scanner is needed for bootstrapping CMake.
...@@ -1307,15 +1308,39 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo, ...@@ -1307,15 +1308,39 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo,
std::string internalDependFile = dir + "/depend.internal"; std::string internalDependFile = dir + "/depend.internal";
std::string dependFile = dir + "/depend.make"; 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. // Check the implicit dependencies to see if they are up to date.
// The build.make file may have explicit dependencies for the object // The build.make file may have explicit dependencies for the object
// files but these will not affect the scanning process so they need // files but these will not affect the scanning process so they need
// not be considered. // not be considered.
cmDependsC checker; cmDependsC checker;
checker.SetVerbose(verbose); checker.SetVerbose(verbose);
checker.SetFileComparison checker.SetFileComparison(ftc);
(this->GlobalGenerator->GetCMakeInstance()->GetFileComparison()); if(needRescan ||
if(!checker.Check(dependFile.c_str(), internalDependFile.c_str())) !checker.Check(dependFile.c_str(), internalDependFile.c_str()))
{ {
// The dependencies must be regenerated. // The dependencies must be regenerated.
std::string targetName = cmSystemTools::GetFilenameName(dir); std::string targetName = cmSystemTools::GetFilenameName(dir);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment