BUG: Require policy version to specify at least major.minor. Do not store CMAKE_BACKWARDS_COMPATIBILITY with an invalid version value.
This commit is contained in:
parent
95512a4c02
commit
7c01167666
|
@ -177,8 +177,11 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
|
||||||
unsigned int patchVer = 0;
|
unsigned int patchVer = 0;
|
||||||
|
|
||||||
// parse the string
|
// parse the string
|
||||||
sscanf(ver.c_str(), "%u.%u.%u",
|
if(sscanf(ver.c_str(), "%u.%u.%u",
|
||||||
&majorVer, &minorVer, &patchVer);
|
&majorVer, &minorVer, &patchVer) < 2)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// 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)
|
||||||
|
@ -186,8 +189,10 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
|
||||||
if (!mf->GetCacheManager()->
|
if (!mf->GetCacheManager()->
|
||||||
GetCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))
|
GetCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))
|
||||||
{
|
{
|
||||||
|
cmOStringStream v;
|
||||||
|
v << majorVer << "." << minorVer << "." << patchVer;
|
||||||
mf->AddCacheDefinition
|
mf->AddCacheDefinition
|
||||||
("CMAKE_BACKWARDS_COMPATIBILITY",version,
|
("CMAKE_BACKWARDS_COMPATIBILITY", v.str().c_str(),
|
||||||
"For backwards compatibility, what version of CMake commands and "
|
"For backwards compatibility, what version of CMake commands and "
|
||||||
"syntax should this version of CMake try to support.",
|
"syntax should this version of CMake try to support.",
|
||||||
cmCacheManager::STRING);
|
cmCacheManager::STRING);
|
||||||
|
|
Loading…
Reference in New Issue