VS: Only generate MIDL options if necessary

The MIDL options were computed and generated for every vcxproj file
before, even if no idl source was actually invocing the compiler.
Now we check first if we actually need to compute these.
This commit is contained in:
John Franklin Rickard authored and Brad King committed 2026-10-26 15:34:09 -04:00
1 parent b07b27d57c
commit 29d594d95a
1 file changed
+10
@@ -5255,6 +5255,16 @@ void cmVisualStudio10TargetGenerator::WriteMidlOptions(
return;
}
cmGeneratorTarget::KindedSources const& sourceFiles =
this->GeneratorTarget->GetKindedSources(configName);
auto isIdlFile = [](cmGeneratorTarget::SourceAndKind const& sourceAndKind) {
return sourceAndKind.Kind == cmGeneratorTarget::SourceKind::SourceKindIDL;
};
if (std::none_of(sourceFiles.Sources.begin(), sourceFiles.Sources.end(),
isIdlFile)) {
return;
}
// This processes *any* of the .idl files specified in the project's file
// list (and passed as the item metadata %(Filename) expressing the rule
// input filename) into output files at the per-config *build* dir