| 141 | } |
| 142 | |
| 143 | void processIncludeDirectories(cmGeneratorTarget const* tgt, |
| 144 | EvaluatedTargetPropertyEntries& entries, |
| 145 | std::vector<BT<std::string>>& includes, |
| 146 | std::unordered_set<std::string>& uniqueIncludes, |
| 147 | bool debugIncludes) |
| 148 | { |
| 149 | for (EvaluatedTargetPropertyEntry& entry : entries.Entries) { |
| 150 | cmLinkItem const& item = entry.LinkItem; |
| 151 | std::string const& targetName = item.AsStr(); |
| 152 | bool const fromImported = item.Target && item.Target->IsImported(); |
| 153 | |
| 154 | std::string usedIncludes; |
| 155 | for (std::string& entryInclude : entry.Values) { |
| 156 | if (fromImported && !cmSystemTools::FileExists(entryInclude)) { |
| 157 | tgt->GetLocalGenerator()->IssueMessage( |
| 158 | MessageType::FATAL_ERROR, |
| 159 | cmStrCat( |
| 160 | "Imported target \"", targetName, |
| 161 | "\" includes non-existent path\n \"", entryInclude, |
| 162 | "\"\nin its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons " |
| 163 | "include:\n" |
| 164 | "* The path was deleted, renamed, or moved to another location.\n" |
| 165 | "* An install or uninstall procedure did not complete " |
| 166 | "successfully.\n" |
| 167 | "* The installation package was faulty and references files it " |
| 168 | "does not provide.\n")); |
| 169 | return; |
| 170 | } |
| 171 | |
| 172 | if (!cmSystemTools::FileIsFullPath(entryInclude)) { |
| 173 | std::ostringstream e; |
| 174 | MessageType messageType = MessageType::FATAL_ERROR; |
| 175 | if (!targetName.empty()) { |
| 176 | /* clang-format off */ |
| 177 | e << "Target \"" << targetName << "\" contains relative " |
| 178 | "path in its INTERFACE_INCLUDE_DIRECTORIES:\n" |
| 179 | " \"" << entryInclude << "\""; |
| 180 | /* clang-format on */ |
| 181 | } else { |
| 182 | e << "Found relative path while evaluating include directories of " |
| 183 | "\"" |
| 184 | << tgt->GetName() << "\":\n \"" << entryInclude << "\"\n"; |
| 185 | } |
| 186 | tgt->GetLocalGenerator()->IssueMessage(messageType, e.str()); |
| 187 | if (messageType == MessageType::FATAL_ERROR) { |
| 188 | return; |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | if (!cmIsOff(entryInclude)) { |
| 193 | cmSystemTools::ConvertToUnixSlashes(entryInclude); |
| 194 | } |
| 195 | |
| 196 | if (uniqueIncludes.insert(entryInclude).second) { |
| 197 | includes.emplace_back(entryInclude, entry.Backtrace); |
| 198 | if (debugIncludes) { |
| 199 | usedIncludes += cmStrCat(" * ", entryInclude, "\n"); |
| 200 | } |
no test coverage detected
searching dependent graphs…