BUG: Fix parsing of policy version number in cmPolicies.
This commit is contained in:
parent
2a06c660bf
commit
95512a4c02
@ -177,23 +177,8 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
|
|||||||
unsigned int patchVer = 0;
|
unsigned int patchVer = 0;
|
||||||
|
|
||||||
// parse the string
|
// parse the string
|
||||||
std::string major = ver.substr(0,ver.find('.'));
|
sscanf(ver.c_str(), "%u.%u.%u",
|
||||||
std::string patch = ver.substr(ver.find('.'));
|
&majorVer, &minorVer, &patchVer);
|
||||||
std::string minor = patch.substr(0,patch.find('.'));
|
|
||||||
patch = patch.substr(patch.find('.'));
|
|
||||||
|
|
||||||
if (major.size())
|
|
||||||
{
|
|
||||||
majorVer = atoi(major.c_str());
|
|
||||||
}
|
|
||||||
if (minor.size())
|
|
||||||
{
|
|
||||||
minorVer = atoi(minor.c_str());
|
|
||||||
}
|
|
||||||
if (patch.size())
|
|
||||||
{
|
|
||||||
patchVer = atoi(patch.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
// add in the old CMAKE_BACKWARDS_COMPATIBILITY var for old CMake compatibility
|
// add in the old CMAKE_BACKWARDS_COMPATIBILITY var for old CMake compatibility
|
||||||
if ((majorVer == 2 && minorVer <= 4) || majorVer < 2)
|
if ((majorVer == 2 && minorVer <= 4) || majorVer < 2)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user