1
0
Эх сурвалжийг харах

BUG: some fixes, still a few to go

Ken Martin 17 жил өмнө
parent
commit
f2c6e9e480

+ 13 - 9
Source/cmConfigureFileCommand.cxx

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

+ 3 - 1
Source/cmMakefile.cxx

@@ -138,6 +138,7 @@ cmMakefile::cmMakefile(const cmMakefile& mf)
   this->PreOrder = mf.PreOrder;
   this->ListFileStack = mf.ListFileStack;
   this->Initialize();
+  this->PushPolicy();
 }
 
 //----------------------------------------------------------------------------
@@ -207,6 +208,7 @@ cmMakefile::~cmMakefile()
     delete b;
     }
   this->FunctionBlockers.clear();
+  this->PolicyStack.pop_back();
 }
 
 void cmMakefile::PrintStringVector(const char* s,
@@ -3245,7 +3247,7 @@ cmPolicies::PolicyStatus cmMakefile
   bool done = false;
 
   // 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--)
   {
     mappos = this->PolicyStack[vecpos].find(id);

+ 13 - 2
Source/cmPolicies.cxx

@@ -112,7 +112,17 @@ cmPolicies::cmPolicies()
     2,6,0, cmPolicies::WARN);
   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()
 {
@@ -188,7 +198,8 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
   // add in the old CMAKE_BACKWARDS_COMPATIBILITY var for old CMake compatibility
   if ((majorVer == 2 && minorVer <= 4) || majorVer < 2)
   {
-    if (!mf->GetCacheManager()->GetCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))
+    if (!mf->GetCacheManager()->
+        GetCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))
     {
       mf->AddCacheDefinition
         ("CMAKE_BACKWARDS_COMPATIBILITY",version, 

+ 3 - 1
Source/cmPolicies.h

@@ -40,7 +40,9 @@ public:
 
   enum PolicyID {CMP_0000, CMP_POLICY_SPECIFICATION = CMP_0000,
                  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