| 368 | } |
| 369 | |
| 370 | void cmGeneratorTarget::CheckLinkLibraries() const |
| 371 | { |
| 372 | bool linkLibrariesOnlyTargets = |
| 373 | this->GetPropertyAsBool("LINK_LIBRARIES_ONLY_TARGETS"); |
| 374 | |
| 375 | // Evaluate the link interface of this target if needed for extra checks. |
| 376 | if (linkLibrariesOnlyTargets) { |
| 377 | std::vector<std::string> const& configs = |
| 378 | this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig); |
| 379 | for (std::string const& config : configs) { |
| 380 | this->GetLinkInterfaceLibraries(config, this, UseTo::Link); |
| 381 | } |
| 382 | } |
| 383 | |
| 384 | // Check link the implementation for each generated configuration. |
| 385 | for (auto const& impl : this->LinkImplMap) { |
| 386 | for (cmLinkItem const& item : impl.second.Libraries) { |
| 387 | if (!this->VerifyLinkItemColons(LinkItemRole::Implementation, item)) { |
| 388 | return; |
| 389 | } |
| 390 | if (linkLibrariesOnlyTargets && |
| 391 | !this->VerifyLinkItemIsTarget(LinkItemRole::Implementation, item)) { |
| 392 | return; |
| 393 | } |
| 394 | } |
| 395 | } |
| 396 | |
| 397 | // Check link the interface for each generated combination of |
| 398 | // configuration and consuming head target. We should not need to |
| 399 | // consider LinkInterfaceUsageRequirementsOnlyMap because its entries |
| 400 | // should be a subset of LinkInterfaceMap (with LINK_ONLY left out). |
| 401 | for (auto const& hmp : this->LinkInterfaceMap) { |
| 402 | for (auto const& hmi : hmp.second) { |
| 403 | if (!hmi.second.LibrariesDone || !hmi.second.CheckLinkLibraries) { |
| 404 | continue; |
| 405 | } |
| 406 | for (cmLinkItem const& item : hmi.second.Libraries) { |
| 407 | if (!this->VerifyLinkItemColons(LinkItemRole::Interface, item)) { |
| 408 | return; |
| 409 | } |
| 410 | if (linkLibrariesOnlyTargets && |
| 411 | !this->VerifyLinkItemIsTarget(LinkItemRole::Interface, item)) { |
| 412 | return; |
| 413 | } |
| 414 | } |
| 415 | } |
| 416 | } |
| 417 | } |
| 418 | |
| 419 | cmGeneratorTarget::CheckLinkLibrariesSuppressionRAII:: |
| 420 | CheckLinkLibrariesSuppressionRAII() |
no test coverage detected