fileAPI: Silently ignore non-target order dependencies

Non-target order dependencies should be caught as project errors.
Prior to f38f325e08 (fileAPI: Add direct dependencies to target
codemodel files, 2025-10-04), they were silently ignored, but that
change crashed on such cases. Restore the old behavior of silently
ignoring such project errors and prevent the crash.

Fixes: #27415
This commit is contained in:
Craig Scott
2025-11-25 16:11:47 +11:00
parent ae5f525826
commit 0f1d773bd7

View File

@@ -2303,8 +2303,10 @@ Json::Value Target::DumpOrderDependencies()
// dependency.
Json::Value jsonDependencies = Json::arrayValue;
for (cmLinkItem const& linkItem : this->GT->GetUtilityItems()) {
// We don't want to dump dependencies on reserved targets like ZERO_CHECK
if (linkItem.Target &&
// We don't want to dump dependencies on reserved targets like ZERO_CHECK.
// We shouldn't see link items that are not targets, but for backward
// compatibility reasons, they are currently allowed but silently ignored.
if (!linkItem.Target ||
cmGlobalGenerator::IsReservedTarget(linkItem.Target->GetName())) {
continue;
}