MCPcopy Create free account
hub / github.com/Kitware/CMake / ScanDependencies

Method ScanDependencies

Source/cmLocalUnixMakefileGenerator3.cxx:1555–1647  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1553}
1554
1555bool cmLocalUnixMakefileGenerator3::ScanDependencies(
1556 std::string const& targetDir, std::string const& dependFile,
1557 std::string const& internalDependFile, cmDepends::DependencyMap& validDeps)
1558{
1559 // Read the directory information file.
1560 cmMakefile* mf = this->Makefile;
1561 bool haveDirectoryInfo = false;
1562 {
1563 std::string dirInfoFile =
1564 cmStrCat(this->GetCurrentBinaryDirectory(),
1565 "/CMakeFiles/CMakeDirectoryInformation.cmake");
1566 if (mf->ReadListFile(dirInfoFile) &&
1567 !cmSystemTools::GetErrorOccurredFlag()) {
1568 haveDirectoryInfo = true;
1569 }
1570 }
1571
1572 // Lookup useful directory information.
1573 if (haveDirectoryInfo) {
1574 // Test whether we need to force Unix paths.
1575 if (cmValue force = mf->GetDefinition("CMAKE_FORCE_UNIX_PATHS")) {
1576 if (!force.IsOff()) {
1577 cmSystemTools::SetForceUnixPaths(true);
1578 }
1579 }
1580
1581 // Setup relative path top directories.
1582 cmValue relativePathTopSource =
1583 mf->GetDefinition("CMAKE_RELATIVE_PATH_TOP_SOURCE");
1584 cmValue relativePathTopBinary =
1585 mf->GetDefinition("CMAKE_RELATIVE_PATH_TOP_BINARY");
1586 if (relativePathTopSource && relativePathTopBinary) {
1587 this->SetRelativePathTop(*relativePathTopSource, *relativePathTopBinary);
1588 }
1589 } else {
1590 cmSystemTools::Error("Directory Information file not found");
1591 }
1592
1593 // Open the make depends file. This should be copy-if-different
1594 // because the make tool may try to reload it needlessly otherwise.
1595 cmGeneratedFileStream ruleFileStream(
1596 dependFile, false, this->GlobalGenerator->GetMakefileEncoding());
1597 ruleFileStream.SetCopyIfDifferent(true);
1598 if (!ruleFileStream) {
1599 return false;
1600 }
1601
1602 // Open the cmake dependency tracking file. This should not be
1603 // copy-if-different because dependencies are re-scanned when it is
1604 // older than the DependInfo.cmake.
1605 cmGeneratedFileStream internalRuleFileStream(
1606 internalDependFile, false, this->GlobalGenerator->GetMakefileEncoding());
1607 if (!internalRuleFileStream) {
1608 return false;
1609 }
1610
1611 this->WriteDisclaimer(ruleFileStream);
1612 this->WriteDisclaimer(internalRuleFileStream);

Callers 1

UpdateDependenciesMethod · 0.95

Calls 15

WriteDisclaimerMethod · 0.95
SetRelativePathTopMethod · 0.80
SetCopyIfDifferentMethod · 0.80
SetFileTimeCacheMethod · 0.80
GetFileTimeCacheMethod · 0.80
SetLanguageMethod · 0.80
SetTargetDirectoryMethod · 0.80
cmStrCatFunction · 0.70
ErrorClass · 0.70
ReadListFileMethod · 0.45
GetDefinitionMethod · 0.45
IsOffMethod · 0.45

Tested by

no test coverage detected