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 @@
#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 =
int result;
if(!ftc->FileTimeCompare(internalDependFile.c_str(), tgtInfo, &result) ||
result < 0)
cmOStringStream msg;
msg << "Dependee \"" << tgtInfo
<< "\" is newer than depender \""
<< internalDependFile << "\"." << std::endl;
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;
if(!checker.Check(dependFile.c_str(), internalDependFile.c_str()))
if(needRescan ||
!checker.Check(dependFile.c_str(), internalDependFile.c_str()))
// The dependencies must be regenerated.
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