瀏覽代碼

Remove barely-used cmMakefile::AddCacheDefinition

The boolean overload of this method was used only to implement option().
We re-implement option() in terms of the main method and removes the
now-unused signature.  This removes some duplicate code that had already
fallen behind on changes (it was not removing the local definition
instead of setting it).
Brad King 16 年之前
父節點
當前提交
afbe088309
共有 3 個文件被更改,包括 2 次插入23 次删除
  1. 0 17
      Source/cmMakefile.cxx
  2. 0 2
      Source/cmMakefile.h
  3. 2 4
      Source/cmOptionCommand.cxx

+ 0 - 17
Source/cmMakefile.cxx

@@ -1720,23 +1720,6 @@ void cmMakefile::AddDefinition(const char* name, bool value)
 #endif
 }
 
-
-void cmMakefile::AddCacheDefinition(const char* name,
-                                    bool value,
-                                    const char* doc)
-{
-  bool val = value;
-  cmCacheManager::CacheIterator it =
-    this->GetCacheManager()->GetCacheIterator(name);
-  if(!it.IsAtEnd() && (it.GetType() == cmCacheManager::UNINITIALIZED) &&
-     it.Initialized())
-    {
-    val = it.GetValueAsBool();
-    }
-  this->GetCacheManager()->AddCacheEntry(name, val, doc);
-  this->AddDefinition(name, val);
-}
-
 void cmMakefile::RemoveDefinition(const char* name)
 {
   this->Internal->VarStack.top().Set(name, 0);

+ 0 - 2
Source/cmMakefile.h

@@ -294,8 +294,6 @@ public:
    * Add bool variable definition to the build. 
    */
   void AddDefinition(const char* name, bool);
-  ///! Add a definition to this makefile and the global cmake cache.
-  void AddCacheDefinition(const char* name, bool, const char* doc);
 
   /**
    * Remove a variable definition from the build.  This is not valid

+ 2 - 4
Source/cmOptionCommand.cxx

@@ -69,9 +69,7 @@ bool cmOptionCommand
     {
     initialValue = args[2];
     }
-  this->Makefile->AddCacheDefinition(args[0].c_str(),
-    cmSystemTools::IsOn(initialValue.c_str()),
-    args[1].c_str());
-
+  this->Makefile->AddCacheDefinition(args[0].c_str(), initialValue.c_str(),
+                                     args[1].c_str(), cmCacheManager::BOOL);
   return true;
 }