| 247 | } |
| 248 | |
| 249 | static std::string stripExportInterface( |
| 250 | cm::string_view input, cmGeneratorExpression::PreprocessContext context, |
| 251 | cm::string_view importPrefix) |
| 252 | { |
| 253 | std::string result; |
| 254 | |
| 255 | int nestingLevel = 0; |
| 256 | std::string::size_type pos = 0; |
| 257 | std::string::size_type lastPos = pos; |
| 258 | while (true) { |
| 259 | std::string::size_type bPos = input.find("$<BUILD_INTERFACE:", lastPos); |
| 260 | std::string::size_type iPos = input.find("$<INSTALL_INTERFACE:", lastPos); |
| 261 | std::string::size_type lPos = |
| 262 | input.find("$<BUILD_LOCAL_INTERFACE:", lastPos); |
| 263 | |
| 264 | pos = std::min({ bPos, iPos, lPos }); |
| 265 | if (pos == std::string::npos) { |
| 266 | break; |
| 267 | } |
| 268 | |
| 269 | result += input.substr(lastPos, pos - lastPos); |
| 270 | enum class FoundGenex |
| 271 | { |
| 272 | BuildInterface, |
| 273 | InstallInterface, |
| 274 | BuildLocalInterface, |
| 275 | } foundGenex = FoundGenex::BuildInterface; |
| 276 | if (pos == bPos) { |
| 277 | foundGenex = FoundGenex::BuildInterface; |
| 278 | pos += cmStrLen("$<BUILD_INTERFACE:"); |
| 279 | } else if (pos == iPos) { |
| 280 | foundGenex = FoundGenex::InstallInterface; |
| 281 | pos += cmStrLen("$<INSTALL_INTERFACE:"); |
| 282 | } else if (pos == lPos) { |
| 283 | foundGenex = FoundGenex::BuildLocalInterface; |
| 284 | pos += cmStrLen("$<BUILD_LOCAL_INTERFACE:"); |
| 285 | } else { |
| 286 | assert(false && "Invalid position found"); |
| 287 | } |
| 288 | nestingLevel = 1; |
| 289 | char const* c = input.data() + pos; |
| 290 | char const* const cStart = c; |
| 291 | for (; *c; ++c) { |
| 292 | if (cmGeneratorExpression::StartsWithGeneratorExpression(c)) { |
| 293 | ++nestingLevel; |
| 294 | ++c; |
| 295 | continue; |
| 296 | } |
| 297 | if (c[0] == '>') { |
| 298 | --nestingLevel; |
| 299 | if (nestingLevel != 0) { |
| 300 | continue; |
| 301 | } |
| 302 | if (context == cmGeneratorExpression::BuildInterface && |
| 303 | foundGenex == FoundGenex::BuildInterface) { |
| 304 | result += input.substr(pos, c - cStart); |
| 305 | } else if (context == cmGeneratorExpression::InstallInterface && |
| 306 | foundGenex == FoundGenex::InstallInterface) { |
no test coverage detected
searching dependent graphs…