| 48 | } |
| 49 | |
| 50 | void computeFilesToInstall( |
| 51 | cmInstallTargetGenerator::Files& files, |
| 52 | cmInstallTargetGenerator::NamelinkModeType namelinkMode, |
| 53 | std::string const& fromDirConfig, std::string const& output, |
| 54 | std::string const& library, std::string const& real, |
| 55 | cm::optional<std::function<void(std::string const&)>> GNUToMS = cm::nullopt) |
| 56 | { |
| 57 | bool haveNamelink = false; |
| 58 | auto convert = [&GNUToMS](std::string const& file) { |
| 59 | if (GNUToMS) { |
| 60 | (*GNUToMS)(file); |
| 61 | } |
| 62 | }; |
| 63 | |
| 64 | // Library link name. |
| 65 | std::string fromName = cmStrCat(fromDirConfig, output); |
| 66 | std::string toName = output; |
| 67 | |
| 68 | // Library interface name. |
| 69 | std::string fromSOName; |
| 70 | std::string toSOName; |
| 71 | if (!library.empty() && library != output) { |
| 72 | haveNamelink = true; |
| 73 | fromSOName = cmStrCat(fromDirConfig, library); |
| 74 | toSOName = library; |
| 75 | } |
| 76 | |
| 77 | // Library implementation name. |
| 78 | std::string fromRealName; |
| 79 | std::string toRealName; |
| 80 | if (real != output && real != library) { |
| 81 | haveNamelink = true; |
| 82 | fromRealName = cmStrCat(fromDirConfig, real); |
| 83 | toRealName = real; |
| 84 | } |
| 85 | |
| 86 | // Add the names based on the current namelink mode. |
| 87 | if (haveNamelink) { |
| 88 | files.NamelinkMode = namelinkMode; |
| 89 | // With a namelink we need to check the mode. |
| 90 | if (namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly) { |
| 91 | // Install the namelink only. |
| 92 | files.From.emplace_back(fromName); |
| 93 | files.To.emplace_back(toName); |
| 94 | convert(output); |
| 95 | } else { |
| 96 | // Install the real file if it has its own name. |
| 97 | if (!fromRealName.empty()) { |
| 98 | files.From.emplace_back(fromRealName); |
| 99 | files.To.emplace_back(toRealName); |
| 100 | convert(real); |
| 101 | } |
| 102 | |
| 103 | // Install the soname link if it has its own name. |
| 104 | if (!fromSOName.empty()) { |
| 105 | files.From.emplace_back(fromSOName); |
| 106 | files.To.emplace_back(toSOName); |
| 107 | convert(library); |
no test coverage detected
searching dependent graphs…