| 375 | } |
| 376 | |
| 377 | bool cmFindLibraryHelper::HasValidSuffix(std::string const& name) |
| 378 | { |
| 379 | for (std::string suffix : this->Suffixes) { |
| 380 | if (name.length() <= suffix.length()) { |
| 381 | continue; |
| 382 | } |
| 383 | // Check if the given name ends in a valid library suffix. |
| 384 | if (name.substr(name.size() - suffix.length()) == suffix) { |
| 385 | return true; |
| 386 | } |
| 387 | // Check if a valid library suffix is somewhere in the name, |
| 388 | // this may happen e.g. for versioned shared libraries: libfoo.so.2 |
| 389 | suffix += "."; |
| 390 | if (name.find(suffix) != std::string::npos) { |
| 391 | return true; |
| 392 | } |
| 393 | } |
| 394 | return false; |
| 395 | } |
| 396 | |
| 397 | void cmFindLibraryHelper::AddName(std::string const& name) |
| 398 | { |