| 1167 | } |
| 1168 | |
| 1169 | std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit( |
| 1170 | cmGeneratorTarget const* target, std::string const& lang, |
| 1171 | std::string const& config, bool stripImplicitDirs, |
| 1172 | bool appendAllImplicitDirs) const |
| 1173 | { |
| 1174 | std::vector<BT<std::string>> result; |
| 1175 | // Do not repeat an include path. |
| 1176 | std::set<std::string> emitted; |
| 1177 | |
| 1178 | auto emitDir = [&result, &emitted](std::string const& dir) { |
| 1179 | if (emitted.insert(dir).second) { |
| 1180 | result.emplace_back(dir); |
| 1181 | } |
| 1182 | }; |
| 1183 | |
| 1184 | auto emitBT = [&result, &emitted](BT<std::string> const& dir) { |
| 1185 | if (emitted.insert(dir.Value).second) { |
| 1186 | result.emplace_back(dir); |
| 1187 | } |
| 1188 | }; |
| 1189 | |
| 1190 | // When automatic include directories are requested for a build then |
| 1191 | // include the source and binary directories at the beginning of the |
| 1192 | // include path to approximate include file behavior for an |
| 1193 | // in-source build. This does not account for the case of a source |
| 1194 | // file in a subdirectory of the current source directory but we |
| 1195 | // cannot fix this because not all native build tools support |
| 1196 | // per-source-file include paths. |
| 1197 | if (this->Makefile->IsOn("CMAKE_INCLUDE_CURRENT_DIR")) { |
| 1198 | // Current binary directory |
| 1199 | emitDir(this->StateSnapshot.GetDirectory().GetCurrentBinary()); |
| 1200 | // Current source directory |
| 1201 | emitDir(this->StateSnapshot.GetDirectory().GetCurrentSource()); |
| 1202 | } |
| 1203 | |
| 1204 | if (!target) { |
| 1205 | return result; |
| 1206 | } |
| 1207 | |
| 1208 | // Standard include directories to be added unconditionally at the end. |
| 1209 | // These are intended to simulate additional implicit include directories. |
| 1210 | cmList userStandardDirs; |
| 1211 | { |
| 1212 | std::string const value = this->Makefile->GetSafeDefinition( |
| 1213 | cmStrCat("CMAKE_", lang, "_STANDARD_INCLUDE_DIRECTORIES")); |
| 1214 | userStandardDirs.assign(value); |
| 1215 | for (std::string& usd : userStandardDirs) { |
| 1216 | cmSystemTools::ConvertToUnixSlashes(usd); |
| 1217 | } |
| 1218 | } |
| 1219 | |
| 1220 | // Implicit include directories |
| 1221 | std::vector<std::string> implicitDirs; |
| 1222 | std::set<std::string> implicitSet; |
| 1223 | // Include directories to be excluded as if they were implicit. |
| 1224 | std::set<std::string> implicitExclude; |
| 1225 | { |
| 1226 | // Raw list of implicit include directories |
no test coverage detected