| 4135 | } |
| 4136 | |
| 4137 | bool cmSystemTools::CheckRPath(std::string const& file, |
| 4138 | std::string const& newRPath) |
| 4139 | { |
| 4140 | // Parse the ELF binary. |
| 4141 | cmELF elf(file.c_str()); |
| 4142 | if (elf) { |
| 4143 | // Get the RPATH or RUNPATH entry from it. |
| 4144 | cmELF::StringEntry const* se = elf.GetRPath(); |
| 4145 | if (!se) { |
| 4146 | se = elf.GetRunPath(); |
| 4147 | } |
| 4148 | |
| 4149 | // Make sure the current rpath contains the new rpath. |
| 4150 | if (newRPath.empty()) { |
| 4151 | if (!se) { |
| 4152 | return true; |
| 4153 | } |
| 4154 | } else { |
| 4155 | if (se && |
| 4156 | cmSystemToolsFindRPath(se->Value, newRPath) != std::string::npos) { |
| 4157 | return true; |
| 4158 | } |
| 4159 | } |
| 4160 | return false; |
| 4161 | } |
| 4162 | #if defined(CMake_USE_XCOFF_PARSER) |
| 4163 | // Parse the XCOFF binary. |
| 4164 | cmXCOFF xcoff(file.c_str()); |
| 4165 | if (xcoff) { |
| 4166 | if (cm::optional<cm::string_view> libPath = xcoff.GetLibPath()) { |
| 4167 | if (cmSystemToolsFindRPath(*libPath, newRPath) != std::string::npos) { |
| 4168 | return true; |
| 4169 | } |
| 4170 | } |
| 4171 | return false; |
| 4172 | } |
| 4173 | #endif |
| 4174 | // The file format is not recognized. Assume it has no RPATH. |
| 4175 | // Therefore we succeed if the new rpath is empty anyway. |
| 4176 | return newRPath.empty(); |
| 4177 | } |
| 4178 | |
| 4179 | cmsys::Status cmSystemTools::RepeatedRemoveDirectory(std::string const& dir) |
| 4180 | { |
nothing calls this directly
no test coverage detected