| 4346 | struct TargetRuntimeDllsBaseNode : public cmGeneratorExpressionNode |
| 4347 | { |
| 4348 | std::vector<std::string> CollectDlls( |
| 4349 | std::vector<std::string> const& parameters, cm::GenEx::Evaluation* eval, |
| 4350 | GeneratorExpressionContent const* content) const |
| 4351 | { |
| 4352 | std::string const& tgtName = parameters.front(); |
| 4353 | cmGeneratorTarget* gt = |
| 4354 | eval->Context.LG->FindGeneratorTargetToUse(tgtName); |
| 4355 | if (!gt) { |
| 4356 | std::ostringstream e; |
| 4357 | e << "Objects of target \"" << tgtName |
| 4358 | << "\" referenced but no such target exists."; |
| 4359 | reportError(eval, content->GetOriginalExpression(), e.str()); |
| 4360 | return std::vector<std::string>(); |
| 4361 | } |
| 4362 | cmStateEnums::TargetType type = gt->GetType(); |
| 4363 | if (type != cmStateEnums::EXECUTABLE && |
| 4364 | type != cmStateEnums::SHARED_LIBRARY && |
| 4365 | type != cmStateEnums::MODULE_LIBRARY) { |
| 4366 | std::ostringstream e; |
| 4367 | e << "Objects of target \"" << tgtName |
| 4368 | << "\" referenced but is not one of the allowed target types " |
| 4369 | << "(EXECUTABLE, SHARED, MODULE)."; |
| 4370 | reportError(eval, content->GetOriginalExpression(), e.str()); |
| 4371 | return std::vector<std::string>(); |
| 4372 | } |
| 4373 | |
| 4374 | if (auto* cli = gt->GetLinkInformation(eval->Context.Config)) { |
| 4375 | std::vector<std::string> dllPaths; |
| 4376 | auto const& dlls = cli->GetRuntimeDLLs(); |
| 4377 | |
| 4378 | for (auto const& dll : dlls) { |
| 4379 | if (auto loc = dll->MaybeGetLocation(eval->Context.Config)) { |
| 4380 | dllPaths.emplace_back(*loc); |
| 4381 | } |
| 4382 | } |
| 4383 | |
| 4384 | return dllPaths; |
| 4385 | } |
| 4386 | |
| 4387 | return std::vector<std::string>(); |
| 4388 | } |
| 4389 | }; |
| 4390 | |
| 4391 | static const struct TargetRuntimeDllsNode : public TargetRuntimeDllsBaseNode |
nothing calls this directly
no test coverage detected