1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-20 21:40:15 +08:00

cmPolicies: Drop unnecessary check from ApplyPolicyVersion

This internal API is never called with `version_min` empty.
This commit is contained in:
Brad King
2018-03-16 12:21:29 -04:00
parent 0df559832b
commit 1d00ed7cf7

View File

@@ -156,22 +156,16 @@ static bool GetPolicyDefault(cmMakefile* mf, std::string const& policy,
bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf,
std::string const& version_min) std::string const& version_min)
{ {
std::string ver = "2.4.0";
if (!version_min.empty()) {
ver = version_min;
}
unsigned int majorVer = 2; unsigned int majorVer = 2;
unsigned int minorVer = 0; unsigned int minorVer = 0;
unsigned int patchVer = 0; unsigned int patchVer = 0;
unsigned int tweakVer = 0; unsigned int tweakVer = 0;
// parse the string // parse the string
if (sscanf(ver.c_str(), "%u.%u.%u.%u", &majorVer, &minorVer, &patchVer, if (sscanf(version_min.c_str(), "%u.%u.%u.%u", &majorVer, &minorVer,
&tweakVer) < 2) { &patchVer, &tweakVer) < 2) {
std::ostringstream e; std::ostringstream e;
e << "Invalid policy version value \"" << ver << "\". " e << "Invalid policy version value \"" << version_min << "\". "
<< "A numeric major.minor[.patch[.tweak]] must be given."; << "A numeric major.minor[.patch[.tweak]] must be given.";
mf->IssueMessage(cmake::FATAL_ERROR, e.str()); mf->IssueMessage(cmake::FATAL_ERROR, e.str());
return false; return false;