BUG: some fixes, still a few to go

This commit is contained in:
Ken Martin 2008-03-05 11:41:25 -05:00
parent 7173f2db0e
commit f2c6e9e480
4 changed files with 32 additions and 13 deletions

View File

@ -42,15 +42,19 @@ bool cmConfigureFileCommand
// for CMake 2.0 and earlier CONFIGURE_FILE defaults to the FinalPass, // for CMake 2.0 and earlier CONFIGURE_FILE defaults to the FinalPass,
// after 2.0 it only does InitialPass // after 2.0 it only does InitialPass, this is policy CMP_0003
this->Immediate = false; switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP_0003))
const char* versionValue {
= this->Makefile->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY"); case cmPolicies::WARN:
if (versionValue && atof(versionValue) > 2.0) cmSystemTools::Message(
{ this->Makefile->GetPolicies()->GetPolicyWarning
this->Immediate = true; (cmPolicies::CMP_0003).c_str(),"Warning");
} case cmPolicies::OLD:
this->Immediate = false;
break;
default:
this->Immediate = true;
}
this->AtOnly = false; this->AtOnly = false;
for(unsigned int i=2;i < args.size();++i) for(unsigned int i=2;i < args.size();++i)

View File

@ -138,6 +138,7 @@ cmMakefile::cmMakefile(const cmMakefile& mf)
this->PreOrder = mf.PreOrder; this->PreOrder = mf.PreOrder;
this->ListFileStack = mf.ListFileStack; this->ListFileStack = mf.ListFileStack;
this->Initialize(); this->Initialize();
this->PushPolicy();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -207,6 +208,7 @@ cmMakefile::~cmMakefile()
delete b; delete b;
} }
this->FunctionBlockers.clear(); this->FunctionBlockers.clear();
this->PolicyStack.pop_back();
} }
void cmMakefile::PrintStringVector(const char* s, void cmMakefile::PrintStringVector(const char* s,
@ -3245,7 +3247,7 @@ cmPolicies::PolicyStatus cmMakefile
bool done = false; bool done = false;
// check our policy stack first // check our policy stack first
for (vecpos = static_cast<int>(this->PolicyStack.size()); for (vecpos = static_cast<int>(this->PolicyStack.size()) - 1;
vecpos >= 0 && !done; vecpos--) vecpos >= 0 && !done; vecpos--)
{ {
mappos = this->PolicyStack[vecpos].find(id); mappos = this->PolicyStack[vecpos].find(id);

View File

@ -112,7 +112,17 @@ cmPolicies::cmPolicies()
2,6,0, cmPolicies::WARN); 2,6,0, cmPolicies::WARN);
this->PolicyStringMap["CMP_REQUIRE_UNIQUE_TARGET_NAMES"] = CMP_0002; this->PolicyStringMap["CMP_REQUIRE_UNIQUE_TARGET_NAMES"] = CMP_0002;
} this->DefinePolicy(CMP_0003, "CMP_0003",
"CMake configures file immediately after 2.0.",
"In CMake 2.0 and earlier the configure_file command would not "
"configure the file until after processing all CMakeLists files. "
"In CMake 2.2 and later the default behavior is that it will "
"configure the file right when the command is invoked."
,
2,2,0, cmPolicies::NEW);
this->PolicyStringMap["CMP_CONFIGURE_FILE_IMMEDIATE"] = CMP_0003;
}
cmPolicies::~cmPolicies() cmPolicies::~cmPolicies()
{ {
@ -188,7 +198,8 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
// 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)
{ {
if (!mf->GetCacheManager()->GetCacheValue("CMAKE_BACKWARDS_COMPATIBILITY")) if (!mf->GetCacheManager()->
GetCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))
{ {
mf->AddCacheDefinition mf->AddCacheDefinition
("CMAKE_BACKWARDS_COMPATIBILITY",version, ("CMAKE_BACKWARDS_COMPATIBILITY",version,

View File

@ -40,7 +40,9 @@ public:
enum PolicyID {CMP_0000, CMP_POLICY_SPECIFICATION = CMP_0000, enum PolicyID {CMP_0000, CMP_POLICY_SPECIFICATION = CMP_0000,
CMP_0001, CMP_TARGET_NAMES_WITH_SLASHES = CMP_0001, CMP_0001, CMP_TARGET_NAMES_WITH_SLASHES = CMP_0001,
CMP_0002, CMP_REQUIRE_UNIQUE_TARGET_NAMES = CMP_0002}; CMP_0002, CMP_REQUIRE_UNIQUE_TARGET_NAMES = CMP_0002,
CMP_0003, CMP_CONFIGURE_FILE_IMMEDIATE = CMP_0003
};
///! convert a string policy ID into a number ///! convert a string policy ID into a number