BUG: Fix subtle bug that prevented Makefile generators from rescanning dependencies when a new source file is added but no other sources are touched.
This commit is contained in:
parent
c905bf9b13
commit
b78997d71d
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue