| 1066 | } |
| 1067 | |
| 1068 | void TransitiveLinkImpl::Compute() |
| 1069 | { |
| 1070 | // Save the original items and start with an empty list. |
| 1071 | std::vector<cmLinkItem> original = std::move(this->Impl.Libraries); |
| 1072 | |
| 1073 | // Avoid injecting any original items as usage requirements. |
| 1074 | // This gives LINK_LIBRARIES final control over the order |
| 1075 | // if it explicitly lists everything. |
| 1076 | this->Emitted.insert(original.cbegin(), original.cend()); |
| 1077 | |
| 1078 | // Process each original item. |
| 1079 | for (cmLinkItem& item : original) { |
| 1080 | // Inject direct dependencies listed in 'INTERFACE_LINK_LIBRARIES_DIRECT' |
| 1081 | // usage requirements before the item itself. |
| 1082 | this->Follow(item.Target); |
| 1083 | |
| 1084 | // Add the item itself. |
| 1085 | this->Impl.Libraries.emplace_back(std::move(item)); |
| 1086 | } |
| 1087 | |
| 1088 | // Remove items listed in 'INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE' |
| 1089 | // usage requirements found through any dependency above. |
| 1090 | this->Impl.Libraries.erase( |
| 1091 | std::remove_if(this->Impl.Libraries.begin(), this->Impl.Libraries.end(), |
| 1092 | [this](cmLinkItem const& item) { |
| 1093 | return this->Excluded.find(item) != this->Excluded.end(); |
| 1094 | }), |
| 1095 | this->Impl.Libraries.end()); |
| 1096 | } |
| 1097 | |
| 1098 | void ComputeLinkImplTransitive(cmGeneratorTarget const* self, |
| 1099 | std::string const& config, UseTo usage, |