Rescan dependencies also if CMakeDirectoryInformation.cmake has changed.
If CMakeDirectoryInformation.cmake is newer than depend.internal the include directories may have changed, so dependencies need to be scanned again. Ok by Brad. Alex
This commit is contained in:
parent
9b6c3d0782
commit
03d032b637
|
@ -352,20 +352,6 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
|
||||||
<< " \""
|
<< " \""
|
||||||
<< lg->Convert(check.c_str(),
|
<< lg->Convert(check.c_str(),
|
||||||
cmLocalGenerator::START_OUTPUT).c_str() << "\"\n";
|
cmLocalGenerator::START_OUTPUT).c_str() << "\"\n";
|
||||||
|
|
||||||
// add in all the directory information files
|
|
||||||
std::string tmpStr;
|
|
||||||
for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
|
|
||||||
{
|
|
||||||
lg =
|
|
||||||
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
|
|
||||||
tmpStr = lg->GetMakefile()->GetStartOutputDirectory();
|
|
||||||
tmpStr += cmake::GetCMakeFilesDirectory();
|
|
||||||
tmpStr += "/CMakeDirectoryInformation.cmake";
|
|
||||||
cmakefileStream << " \"" <<
|
|
||||||
lg->Convert(tmpStr.c_str(),cmLocalGenerator::HOME_OUTPUT).c_str()
|
|
||||||
<< "\"\n";
|
|
||||||
}
|
|
||||||
cmakefileStream << " )\n\n";
|
cmakefileStream << " )\n\n";
|
||||||
|
|
||||||
// CMake must rerun if a byproduct is missing.
|
// CMake must rerun if a byproduct is missing.
|
||||||
|
@ -382,6 +368,20 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
|
||||||
lg->Convert(k->c_str(),cmLocalGenerator::HOME_OUTPUT).c_str()
|
lg->Convert(k->c_str(),cmLocalGenerator::HOME_OUTPUT).c_str()
|
||||||
<< "\"\n";
|
<< "\"\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add in all the directory information files
|
||||||
|
std::string tmpStr;
|
||||||
|
for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
|
||||||
|
{
|
||||||
|
lg =
|
||||||
|
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
|
||||||
|
tmpStr = lg->GetMakefile()->GetStartOutputDirectory();
|
||||||
|
tmpStr += cmake::GetCMakeFilesDirectory();
|
||||||
|
tmpStr += "/CMakeDirectoryInformation.cmake";
|
||||||
|
cmakefileStream << " \"" <<
|
||||||
|
lg->Convert(tmpStr.c_str(),cmLocalGenerator::HOME_OUTPUT).c_str()
|
||||||
|
<< "\"\n";
|
||||||
|
}
|
||||||
cmakefileStream << " )\n\n";
|
cmakefileStream << " )\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -436,6 +436,7 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
infoFileStream.SetCopyIfDifferent(true);
|
||||||
// Write the do not edit header.
|
// Write the do not edit header.
|
||||||
this->WriteDisclaimer(infoFileStream);
|
this->WriteDisclaimer(infoFileStream);
|
||||||
|
|
||||||
|
@ -1352,7 +1353,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo,
|
||||||
// time dependencies were scanned then force rescanning. This may
|
// time dependencies were scanned then force rescanning. This may
|
||||||
// happen when a new source file is added and CMake regenerates the
|
// happen when a new source file is added and CMake regenerates the
|
||||||
// project but no other sources were touched.
|
// project but no other sources were touched.
|
||||||
bool needRescan = false;
|
bool needRescanDependInfo = false;
|
||||||
cmFileTimeComparison* ftc =
|
cmFileTimeComparison* ftc =
|
||||||
this->GlobalGenerator->GetCMakeInstance()->GetFileComparison();
|
this->GlobalGenerator->GetCMakeInstance()->GetFileComparison();
|
||||||
{
|
{
|
||||||
|
@ -1368,7 +1369,30 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo,
|
||||||
<< internalDependFile << "\"." << std::endl;
|
<< internalDependFile << "\"." << std::endl;
|
||||||
cmSystemTools::Stdout(msg.str().c_str());
|
cmSystemTools::Stdout(msg.str().c_str());
|
||||||
}
|
}
|
||||||
needRescan = true;
|
needRescanDependInfo = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the directory information is newer than depend.internal, include dirs
|
||||||
|
// may have changed. In this case discard all old dependencies.
|
||||||
|
bool needRescanDirInfo = false;
|
||||||
|
std::string dirInfoFile = this->Makefile->GetStartOutputDirectory();
|
||||||
|
dirInfoFile += cmake::GetCMakeFilesDirectory();
|
||||||
|
dirInfoFile += "/CMakeDirectoryInformation.cmake";
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
if(!ftc->FileTimeCompare(internalDependFile.c_str(),
|
||||||
|
dirInfoFile.c_str(), &result) || result < 0)
|
||||||
|
{
|
||||||
|
if(verbose)
|
||||||
|
{
|
||||||
|
cmOStringStream msg;
|
||||||
|
msg << "Dependee \"" << internalDependFile
|
||||||
|
<< "\" is newer than depender \""
|
||||||
|
<< dirInfoFile << "\"." << std::endl;
|
||||||
|
cmSystemTools::Stdout(msg.str().c_str());
|
||||||
|
}
|
||||||
|
needRescanDirInfo = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1376,11 +1400,17 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo,
|
||||||
// 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.
|
||||||
|
bool needRescanDependencies = false;
|
||||||
|
if (needRescanDirInfo == false)
|
||||||
|
{
|
||||||
cmDependsC checker;
|
cmDependsC checker;
|
||||||
checker.SetVerbose(verbose);
|
checker.SetVerbose(verbose);
|
||||||
checker.SetFileComparison(ftc);
|
checker.SetFileComparison(ftc);
|
||||||
if(needRescan ||
|
needRescanDependencies = !checker.Check(dependFile.c_str(),
|
||||||
!checker.Check(dependFile.c_str(), internalDependFile.c_str()))
|
internalDependFile.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(needRescanDependInfo || needRescanDirInfo || needRescanDependencies)
|
||||||
{
|
{
|
||||||
// The dependencies must be regenerated.
|
// The dependencies must be regenerated.
|
||||||
std::string targetName = cmSystemTools::GetFilenameName(dir);
|
std::string targetName = cmSystemTools::GetFilenameName(dir);
|
||||||
|
|
Loading…
Reference in New Issue