| 135 | } |
| 136 | |
| 137 | bool HandleVersionMode(std::vector<std::string> const& args, |
| 138 | cmExecutionStatus& status) |
| 139 | { |
| 140 | if (args.size() <= 1) { |
| 141 | status.SetError("VERSION not given an argument"); |
| 142 | return false; |
| 143 | } |
| 144 | if (args.size() >= 3) { |
| 145 | status.SetError("VERSION given too many arguments"); |
| 146 | return false; |
| 147 | } |
| 148 | std::string const& version_string = args[1]; |
| 149 | |
| 150 | // Separate the <min> version and any trailing ...<max> component. |
| 151 | std::string::size_type const dd = version_string.find("..."); |
| 152 | std::string const version_min = version_string.substr(0, dd); |
| 153 | std::string const version_max = dd != std::string::npos |
| 154 | ? version_string.substr(dd + 3, std::string::npos) |
| 155 | : std::string(); |
| 156 | if (dd != std::string::npos && |
| 157 | (version_min.empty() || version_max.empty())) { |
| 158 | status.SetError( |
| 159 | cmStrCat("VERSION \"", version_string, |
| 160 | R"(" does not have a version on both sides of "...".)")); |
| 161 | return false; |
| 162 | } |
| 163 | |
| 164 | return status.GetMakefile().SetPolicyVersion(version_min, version_max); |
| 165 | } |
| 166 | |
| 167 | bool HandleGetWarningMode(std::vector<std::string> const& args, |
| 168 | cmExecutionStatus& status) |
no test coverage detected
searching dependent graphs…