| 1137 | } |
| 1138 | |
| 1139 | bool HandleRPathRemoveCommand(std::vector<std::string> const& args, |
| 1140 | cmExecutionStatus& status) |
| 1141 | { |
| 1142 | // Evaluate arguments. |
| 1143 | std::string file; |
| 1144 | cmArgumentParser<void> parser; |
| 1145 | std::vector<std::string> unknownArgs; |
| 1146 | parser.Bind("FILE"_s, file); |
| 1147 | ArgumentParser::ParseResult parseResult = |
| 1148 | parser.Parse(cmMakeRange(args).advance(1), &unknownArgs); |
| 1149 | if (!unknownArgs.empty()) { |
| 1150 | status.SetError( |
| 1151 | cmStrCat("RPATH_REMOVE given unknown argument ", unknownArgs.front())); |
| 1152 | return false; |
| 1153 | } |
| 1154 | if (parseResult.MaybeReportError(status.GetMakefile())) { |
| 1155 | return true; |
| 1156 | } |
| 1157 | if (file.empty()) { |
| 1158 | status.SetError("RPATH_REMOVE not given FILE option."); |
| 1159 | return false; |
| 1160 | } |
| 1161 | if (!cmSystemTools::FileExists(file, true)) { |
| 1162 | status.SetError( |
| 1163 | cmStrCat("RPATH_REMOVE given FILE \"", file, "\" that does not exist.")); |
| 1164 | return false; |
| 1165 | } |
| 1166 | bool success = true; |
| 1167 | cmFileTimes const ft(file); |
| 1168 | std::string emsg; |
| 1169 | bool removed; |
| 1170 | if (!cmSystemTools::RemoveRPath(file, &emsg, &removed)) { |
| 1171 | status.SetError( |
| 1172 | cmStrCat("RPATH_REMOVE could not remove RPATH from file: \n ", file, |
| 1173 | '\n', emsg)); |
| 1174 | success = false; |
| 1175 | } |
| 1176 | if (success) { |
| 1177 | if (removed) { |
| 1178 | std::string message = |
| 1179 | cmStrCat("Removed runtime path from \"", file, '"'); |
| 1180 | status.GetMakefile().DisplayStatus(message, -1); |
| 1181 | } |
| 1182 | ft.Store(file); |
| 1183 | } |
| 1184 | return success; |
| 1185 | } |
| 1186 | |
| 1187 | bool HandleRPathCheckCommand(std::vector<std::string> const& args, |
| 1188 | cmExecutionStatus& status) |
nothing calls this directly
no test coverage detected
searching dependent graphs…