cmGlobalGenerator: Constify GetTargetDirectDepends

It should only be called for targets whose dependencies are already
computed.
This commit is contained in:
Brad King
2025-08-29 11:45:07 -04:00
parent c07545b945
commit 93e34a5e0e
2 changed files with 6 additions and 3 deletions

View File

@@ -3389,9 +3389,12 @@ cmValue cmGlobalGenerator::GetDebuggerWorkingDirectory(
}
cmGlobalGenerator::TargetDependSet const&
cmGlobalGenerator::GetTargetDirectDepends(cmGeneratorTarget const* target)
cmGlobalGenerator::GetTargetDirectDepends(
cmGeneratorTarget const* target) const
{
return this->TargetDependencies[target];
auto i = this->TargetDependencies.find(target);
assert(i != this->TargetDependencies.end());
return i->second;
}
bool cmGlobalGenerator::TargetOrderIndexLess(cmGeneratorTarget const* l,

View File

@@ -525,7 +525,7 @@ public:
// what targets does the specified target depend on directly
// via a target_link_libraries or add_dependencies
TargetDependSet const& GetTargetDirectDepends(
cmGeneratorTarget const* target);
cmGeneratorTarget const* target) const;
// Return true if target 'l' occurs before 'r' in a global ordering
// of targets that respects inter-target dependencies.