do a lot of cleanup on the arguments because this is one place where folks sometimes take the output of a program and pass it directly into this command not thinking that a single argument could be filled with spaces and newlines etc like below: " /foo/bar /boo/hoo /dingle/berry " ideally that should be three separate arguments but when sucking the output from a program and passing it into a c
| 90 | // always happen |
| 91 | // |
| 92 | static void GetIncludes(cmMakefile& mf, std::string const& arg, |
| 93 | std::vector<std::string>& incs) |
| 94 | { |
| 95 | // break apart any line feed arguments |
| 96 | std::string::size_type pos = 0; |
| 97 | std::string::size_type lastPos = 0; |
| 98 | while ((pos = arg.find('\n', lastPos)) != std::string::npos) { |
| 99 | if (pos) { |
| 100 | std::string inc = arg.substr(lastPos, pos); |
| 101 | NormalizeInclude(mf, inc); |
| 102 | if (!inc.empty()) { |
| 103 | incs.push_back(std::move(inc)); |
| 104 | } |
| 105 | } |
| 106 | lastPos = pos + 1; |
| 107 | } |
| 108 | std::string inc = arg.substr(lastPos); |
| 109 | NormalizeInclude(mf, inc); |
| 110 | if (!inc.empty()) { |
| 111 | incs.push_back(std::move(inc)); |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | static void NormalizeInclude(cmMakefile& mf, std::string& inc) |
| 116 | { |
no test coverage detected
searching dependent graphs…