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

Method UpdateDependencies

Source/cmLocalUnixMakefileGenerator3.cxx:1387–1553  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1385}
1386
1387bool cmLocalUnixMakefileGenerator3::UpdateDependencies(
1388 std::string const& tgtInfo, std::string const& targetName, bool verbose,
1389 bool color)
1390{
1391 // read in the target info file
1392 if (!this->Makefile->ReadListFile(tgtInfo) ||
1393 cmSystemTools::GetErrorOccurredFlag()) {
1394 cmSystemTools::Error("Target DependInfo.cmake file not found");
1395 }
1396
1397 bool status = true;
1398
1399 // Check if any multiple output pairs have a missing file.
1400 this->CheckMultipleOutputs(verbose);
1401
1402 auto echoColor = [color](std::string const& m) {
1403 cm::StdIo::TermAttrSet attrs;
1404 if (color) {
1405 attrs = {
1406 cm::StdIo::TermAttr::ForegroundMagenta,
1407 cm::StdIo::TermAttr::ForegroundBold,
1408 };
1409 }
1410 Print(cm::StdIo::Out(), attrs, m);
1411 std::cout << std::endl;
1412 };
1413
1414 std::string const targetDir = cmSystemTools::GetFilenamePath(tgtInfo);
1415 if (!this->Makefile->GetSafeDefinition("CMAKE_DEPENDS_LANGUAGES").empty()) {
1416 // dependencies are managed by CMake itself
1417
1418 std::string const internalDependFile = targetDir + "/depend.internal";
1419 std::string const dependFile = targetDir + "/depend.make";
1420
1421 // If the target DependInfo.cmake file has changed since the last
1422 // time dependencies were scanned then force rescanning. This may
1423 // happen when a new source file is added and CMake regenerates the
1424 // project but no other sources were touched.
1425 bool needRescanDependInfo = false;
1426 cmFileTimeCache* ftc =
1427 this->GlobalGenerator->GetCMakeInstance()->GetFileTimeCache();
1428 {
1429 int result;
1430 if (!ftc->Compare(internalDependFile, tgtInfo, &result) || result < 0) {
1431 if (verbose) {
1432 cmSystemTools::Stdout(cmStrCat("Dependee \"", tgtInfo,
1433 "\" is newer than depender \"",
1434 internalDependFile, "\".\n"));
1435 }
1436 needRescanDependInfo = true;
1437 }
1438 }
1439
1440 // If the directory information is newer than depend.internal, include
1441 // dirs may have changed. In this case discard all old dependencies.
1442 bool needRescanDirInfo = false;
1443 {
1444 std::string dirInfoFile =

Callers 1

ExecuteCMakeCommandMethod · 0.45

Calls 15

CheckMultipleOutputsMethod · 0.95
ScanDependenciesMethod · 0.95
WriteDisclaimerMethod · 0.95
PrintFunction · 0.85
cmIsOnFunction · 0.85
NotInProjectDirClass · 0.85
GetFileTimeCacheMethod · 0.80
SetFileTimeCacheMethod · 0.80
SetCopyIfDifferentMethod · 0.80
ErrorClass · 0.70
cmStrCatFunction · 0.70
ReadListFileMethod · 0.45

Tested by

no test coverage detected