瀏覽代碼

ENH: big change, only allow commands access to the cache via the cmMakefile class and GetDefinition, also the cmMakefile is the only way for commands to add to the cache. Also, some changes to configure.in that check for for scoping

Bill Hoffman 24 年之前
父節點
當前提交
db1303aa7d

+ 1 - 1
Source/MFCDialog/CMakeSetupDialog.cpp

@@ -533,7 +533,7 @@ void CMakeSetupDialog::FillCacheGUIFromCacheManager()
     switch(value.m_Type )
     switch(value.m_Type )
       {
       {
       case cmCacheManager::BOOL:
       case cmCacheManager::BOOL:
-        if(cmCacheManager::GetInstance()->IsOn(key))
+        if(cmSystemTools::IsOn(value.m_Value.c_str()))
           {
           {
           m_CacheEntriesList.AddProperty(key,
           m_CacheEntriesList.AddProperty(key,
                                          "ON",
                                          "ON",

+ 6 - 7
Source/cmBuildCommand.cxx

@@ -50,7 +50,7 @@ bool cmBuildCommand::InitialPass(std::vector<std::string>& args)
     }
     }
   const char* define = args[0].c_str();
   const char* define = args[0].c_str();
   const char* cacheValue
   const char* cacheValue
-    = cmCacheManager::GetInstance()->GetCacheValue(define);
+    = m_Makefile->GetDefinition(define);
   if(cacheValue)
   if(cacheValue)
     {
     {
     return true;
     return true;
@@ -73,12 +73,11 @@ bool cmBuildCommand::InitialPass(std::vector<std::string>& args)
     makecommand = makeprogram;
     makecommand = makeprogram;
     makecommand += " -k";
     makecommand += " -k";
     }
     }
-  cmCacheManager::GetInstance()->
-    AddCacheEntry(define,
-                  makecommand.c_str(),
-                  "Command used to build entire project from the command line.",
-                  cmCacheManager::STRING);
-  m_Makefile->AddDefinition(define, makecommand.c_str());
+  m_Makefile->AddCacheDefinition(define,
+                                 makecommand.c_str(),
+                                 "Command used to build entire project "
+                                 "from the command line.",
+                                 cmCacheManager::STRING);
   return true;
   return true;
 }
 }
 
 

+ 9 - 18
Source/cmBuildNameCommand.cxx

@@ -49,7 +49,7 @@ bool cmBuildNameCommand::InitialPass(std::vector<std::string>& args)
     return false;
     return false;
     }
     }
   const char* cacheValue
   const char* cacheValue
-    = cmCacheManager::GetInstance()->GetCacheValue("BUILDNAME");
+    = m_Makefile->GetDefinition("BUILDNAME");
   if(cacheValue)
   if(cacheValue)
     {
     {
     // do we need to correct the value? 
     // do we need to correct the value? 
@@ -60,16 +60,10 @@ bool cmBuildNameCommand::InitialPass(std::vector<std::string>& args)
       cmSystemTools::ReplaceString(cv,"/", "_");
       cmSystemTools::ReplaceString(cv,"/", "_");
       cmSystemTools::ReplaceString(cv,"(", "_");
       cmSystemTools::ReplaceString(cv,"(", "_");
       cmSystemTools::ReplaceString(cv,")", "_");
       cmSystemTools::ReplaceString(cv,")", "_");
-      cmCacheManager::GetInstance()->
-        AddCacheEntry("BUILDNAME",
-                      cv.c_str(),
-                      "Name of build.",
-                      cmCacheManager::STRING);
-      m_Makefile->AddDefinition("BUILDNAME", cv.c_str());
-      }
-    else
-      {
-      m_Makefile->AddDefinition("BUILDNAME", cacheValue);
+      m_Makefile->AddCacheDefinition("BUILDNAME",
+                                     cv.c_str(),
+                                     "Name of build.",
+                                     cmCacheManager::STRING);
       }
       }
     return true;
     return true;
     }
     }
@@ -101,13 +95,10 @@ bool cmBuildNameCommand::InitialPass(std::vector<std::string>& args)
   cmSystemTools::ReplaceString(buildname,
   cmSystemTools::ReplaceString(buildname,
                                ")", "_");
                                ")", "_");
   
   
-  cmCacheManager::GetInstance()->
-    AddCacheEntry("BUILDNAME",
-                  buildname.c_str(),
-                  "Name of build.",
-                  cmCacheManager::STRING);
-
-  m_Makefile->AddDefinition("BUILDNAME", buildname.c_str());
+  m_Makefile->AddCacheDefinition("BUILDNAME",
+                                 buildname.c_str(),
+                                 "Name of build.",
+                                 cmCacheManager::STRING);
   return true;
   return true;
 }
 }
 
 

+ 12 - 15
Source/cmCableWrapTclCommand.cxx

@@ -408,15 +408,14 @@ void cmCableWrapTclCommand::GenerateCableClassFiles(const char* name,
 std::string cmCableWrapTclCommand::GetGccXmlFromCache() const
 std::string cmCableWrapTclCommand::GetGccXmlFromCache() const
 {
 {
   const char* gccxml =
   const char* gccxml =
-    cmCacheManager::GetInstance()->GetCacheValue("GCCXML");
+    m_Makefile->GetDefinition("GCCXML");
   if(gccxml)
   if(gccxml)
     { return gccxml; }
     { return gccxml; }
 
 
-  m_Makefile->AddDefinition("GCCXML","NOTFOUND");
-  cmCacheManager::GetInstance()->AddCacheEntry("GCCXML",
-					       "NOTFOUND",
-					       "Path to GCC-XML executable.",
-					       cmCacheManager::FILEPATH);
+  m_Makefile->AddCacheDefinition("GCCXML",
+                                 "NOTFOUND",
+                                 "Path to GCC-XML executable.",
+                                 cmCacheManager::FILEPATH);
   return "NOTFOUND";
   return "NOTFOUND";
 }
 }
 
 
@@ -428,12 +427,11 @@ std::string cmCableWrapTclCommand::GetGccXmlFromCache() const
 std::string cmCableWrapTclCommand::GetGccXmlFlagsFromCache() const
 std::string cmCableWrapTclCommand::GetGccXmlFlagsFromCache() const
 {
 {
   const char* gccxmlFlags =
   const char* gccxmlFlags =
-    cmCacheManager::GetInstance()->GetCacheValue("GCCXML_FLAGS");
+    m_Makefile->GetDefinition("GCCXML_FLAGS");
   if(gccxmlFlags)
   if(gccxmlFlags)
     { return gccxmlFlags; }
     { return gccxmlFlags; }
 
 
-  m_Makefile->AddDefinition("GCCXML_FLAGS","");
-  cmCacheManager::GetInstance()->AddCacheEntry(
+  m_Makefile->AddCacheDefinition(
     "GCCXML_FLAGS",
     "GCCXML_FLAGS",
     "",
     "",
     "Flags to GCC-XML to get it to parse the native compiler's headers.",
     "Flags to GCC-XML to get it to parse the native compiler's headers.",
@@ -449,14 +447,13 @@ std::string cmCableWrapTclCommand::GetGccXmlFlagsFromCache() const
 std::string cmCableWrapTclCommand::GetCableFromCache() const
 std::string cmCableWrapTclCommand::GetCableFromCache() const
 {
 {
   const char* cable =
   const char* cable =
-    cmCacheManager::GetInstance()->GetCacheValue("CABLE");
+    m_Makefile->GetDefinition("CABLE");
   if(cable)
   if(cable)
     { return cable; }
     { return cable; }
 
 
-  m_Makefile->AddDefinition("CABLE","NOTFOUND");
-  cmCacheManager::GetInstance()->AddCacheEntry("CABLE",
-					       "NOTFOUND",
-					       "Path to CABLE executable.",
-					       cmCacheManager::FILEPATH);
+  m_Makefile->AddCacheDefinition("CABLE",
+                                 "NOTFOUND",
+                                 "Path to CABLE executable.",
+                                 cmCacheManager::FILEPATH);
   return "NOTFOUND";
   return "NOTFOUND";
 }
 }

+ 0 - 12
Source/cmCacheManager.cxx

@@ -375,18 +375,6 @@ const char* cmCacheManager::GetCacheValue(const char* key) const
 }
 }
 
 
 
 
-bool cmCacheManager::IsOn(const char* key) const
-{ 
-  if(!m_Cache.count(key))
-    {
-    return false;
-    }
-  const std::string &v = m_Cache.find(key)->second.m_Value;
-  return cmSystemTools::IsOn(v.c_str());
-}
-
-
-
 void cmCacheManager::PrintCache(std::ostream& out) const
 void cmCacheManager::PrintCache(std::ostream& out) const
 {
 {
   out << "=================================================" << std::endl;
   out << "=================================================" << std::endl;

+ 26 - 26
Source/cmCacheManager.h

@@ -70,55 +70,55 @@ public:
    * can be different than just a path input
    * can be different than just a path input
    */
    */
   static CacheEntryType StringToType(const char*);
   static CacheEntryType StringToType(const char*);
-  //! Singleton pattern get instance of the cmCacheManager.
+  ///! Singleton pattern get instance of the cmCacheManager.
   static cmCacheManager* GetInstance();
   static cmCacheManager* GetInstance();
-
   
   
-  //! Load a cache for given makefile.  Loads from ouput home.
+  ///! Load a cache for given makefile.  Loads from ouput home.
   bool LoadCache(cmMakefile*); 
   bool LoadCache(cmMakefile*); 
-  //! Load a cache for given makefile.  Loads from path/CMakeCache.txt.
+  ///! Load a cache for given makefile.  Loads from path/CMakeCache.txt.
   bool LoadCache(const char* path);
   bool LoadCache(const char* path);
   bool LoadCache(const char* path, bool internal);
   bool LoadCache(const char* path, bool internal);
 
 
-  //! Put cache definitions into makefile
+  ///! Put cache definitions into makefile
   void DefineCache(cmMakefile*); 
   void DefineCache(cmMakefile*); 
   
   
-  //! Save cache for given makefile.  Saves to ouput home CMakeCache.txt.
+  ///! Save cache for given makefile.  Saves to ouput home CMakeCache.txt.
   bool SaveCache(cmMakefile*) ;
   bool SaveCache(cmMakefile*) ;
-  //! Save cache for given makefile.  Saves to ouput path/CMakeCache.txt
+  ///! Save cache for given makefile.  Saves to ouput path/CMakeCache.txt
   bool SaveCache(const char* path) ;
   bool SaveCache(const char* path) ;
+
+  ///! Print the cache to a stream
+  void PrintCache(std::ostream&) const;
   
   
-  //! Add an entry into the cache
-  void AddCacheEntry(const char* key, const char* value, 
-                     const char* helpString, CacheEntryType type);
+  ///! Get the cache map ivar.
+  const CacheEntryMap &GetCacheMap() const { return m_Cache; }
 
 
-  //! Add a BOOL entry into the cache
-  void AddCacheEntry(const char* key, bool, const char* helpString);
+  ///! Get a cache entry object for a key
+  CacheEntry *GetCacheEntry(const char *key);
   
   
-  //! Remove an entry from the cache
+  ///! Remove an entry from the cache
   void RemoveCacheEntry(const char* key);
   void RemoveCacheEntry(const char* key);
   
   
-  //! Print the cache to a stream
-  CacheEntry *GetCacheEntry(const char *key);
+protected:
+  ///! Add an entry into the cache
+  void AddCacheEntry(const char* key, const char* value, 
+                     const char* helpString, CacheEntryType type);
+
+  ///! Add a BOOL entry into the cache
+  void AddCacheEntry(const char* key, bool, const char* helpString);
   
   
-  //! Get a value from the cache given a key
+  ///! Get a value from the cache given a key
   const char* GetCacheValue(const char* key) const;
   const char* GetCacheValue(const char* key) const;
 
 
-  //! Test a boolean cache entry to see if it is true or false, returns false 
-  //  if no entry.
-  bool IsOn(const char*) const;
-  
-  //! Print the cache to a stream
-  void PrintCache(std::ostream&) const;
-  
-  //! Get the cache map ivar.
-  const CacheEntryMap &GetCacheMap() const { return m_Cache; }
-  
 private:
 private:
   static void OutputHelpString(std::ofstream& fout, 
   static void OutputHelpString(std::ofstream& fout, 
                                const std::string& helpString);
                                const std::string& helpString);
   static cmCacheManager* s_Instance;
   static cmCacheManager* s_Instance;
   CacheEntryMap m_Cache;
   CacheEntryMap m_Cache;
+  // Only cmake and cmMakefile should be able to add cache values
+  // the commands should never use the cmCacheManager directly
+  friend class cmMakefile; // allow access to add cache values
+  friend class cmake; // allow access to add cache values
 };
 };
 
 
 #endif
 #endif

+ 2 - 0
Source/cmConfigure.h.in

@@ -1,2 +1,4 @@
 #undef CMAKE_NO_STD_NAMESPACE
 #undef CMAKE_NO_STD_NAMESPACE
 #undef CMAKE_NO_ANSI_STREAM_HEADERS
 #undef CMAKE_NO_ANSI_STREAM_HEADERS
+#undef CMAKE_NO_ANSI_FOR_SCOPE
+

+ 2 - 3
Source/cmConfigureGccXmlCommand.cxx

@@ -61,7 +61,7 @@ bool cmConfigureGccXmlCommand::InitialPass(std::vector<std::string>& args)
   // If the cache entry already exists, we are done.
   // If the cache entry already exists, we are done.
   std::string cacheName = args[1];
   std::string cacheName = args[1];
   const char* cacheValue =
   const char* cacheValue =
-    cmCacheManager::GetInstance()->GetCacheValue(cacheName.c_str());
+    m_Makefile->GetDefinition(cacheName.c_str());
   if(cacheValue && (std::string(cacheValue) != ""))
   if(cacheValue && (std::string(cacheValue) != ""))
     { return true; }
     { return true; }
   
   
@@ -95,8 +95,7 @@ bool cmConfigureGccXmlCommand::InitialPass(std::vector<std::string>& args)
 #endif
 #endif
   
   
   // Add the cache entry with the flags found.
   // Add the cache entry with the flags found.
-  m_Makefile->AddDefinition(cacheName.c_str(), m_Flags.c_str());
-  cmCacheManager::GetInstance()->AddCacheEntry(
+  m_Makefile->AddCacheDefinition(
     cacheName.c_str(),
     cacheName.c_str(),
     m_Flags.c_str(),
     m_Flags.c_str(),
     "Flags to GCC-XML to get it to parse the native compiler's headers.",
     "Flags to GCC-XML to get it to parse the native compiler's headers.",

+ 1 - 1
Source/cmDSPWriter.cxx

@@ -371,7 +371,7 @@ void cmDSPWriter::WriteDSPEndGroup(std::ostream& fout)
 
 
 void cmDSPWriter::SetBuildType(BuildType b, const char *libName)
 void cmDSPWriter::SetBuildType(BuildType b, const char *libName)
 {
 {
-  std::string root= cmCacheManager::GetInstance()->GetCacheValue("CMAKE_ROOT");
+  std::string root= m_Makefile->GetDefinition("CMAKE_ROOT");
   const char *def= m_Makefile->GetDefinition( "MSPROJECT_TEMPLATE_DIRECTORY");
   const char *def= m_Makefile->GetDefinition( "MSPROJECT_TEMPLATE_DIRECTORY");
 
 
   if( def)
   if( def)

+ 1 - 1
Source/cmDSWWriter.cxx

@@ -220,7 +220,7 @@ void cmDSWWriter::WriteProject(std::ostream& fout,
         {
         {
         // is the library part of this DSW ? If so add dependency
         // is the library part of this DSW ? If so add dependency
         const char* cacheValue
         const char* cacheValue
-          = cmCacheManager::GetInstance()->GetCacheValue(j->first.c_str());
+          = m_Makefile->GetDefinition(j->first.c_str());
         if(cacheValue)
         if(cacheValue)
           {
           {
           fout << "Begin Project Dependency\n";
           fout << "Begin Project Dependency\n";

+ 5 - 12
Source/cmFindFileCommand.cxx

@@ -62,15 +62,9 @@ bool cmFindFileCommand::InitialPass(std::vector<std::string>& args)
   std::string helpString = "Where can the ";
   std::string helpString = "Where can the ";
   helpString += args[1] + " file be found";
   helpString += args[1] + " file be found";
   const char* cacheValue
   const char* cacheValue
-    = cmCacheManager::GetInstance()->GetCacheValue(define);
+    = m_Makefile->GetDefinition(define);
   if(cacheValue && strcmp(cacheValue, "NOTFOUND"))
   if(cacheValue && strcmp(cacheValue, "NOTFOUND"))
     {
     {
-      m_Makefile->AddDefinition(define, cacheValue);
-      // update help string if changed
-      cmCacheManager::GetInstance()->AddCacheEntry(define,
-                                                   cacheValue,
-                                                   helpString.c_str(),
-                                                   cmCacheManager::FILEPATH);
     return true;
     return true;
     }
     }
   // if it is not in the cache, then search the system path
   // if it is not in the cache, then search the system path
@@ -95,11 +89,10 @@ bool cmFindFileCommand::InitialPass(std::vector<std::string>& args)
     if(cmSystemTools::FileExists(tryPath.c_str()))
     if(cmSystemTools::FileExists(tryPath.c_str()))
       {
       {
       // Save the value in the cache
       // Save the value in the cache
-      m_Makefile->AddDefinition(define, tryPath.c_str());
-      cmCacheManager::GetInstance()->AddCacheEntry(define,
-                                                   tryPath.c_str(),
-                                                   helpString.c_str(),
-                                                   cmCacheManager::FILEPATH);
+      m_Makefile->AddCacheDefinition(define,
+                                     tryPath.c_str(),
+                                     helpString.c_str(),
+                                     cmCacheManager::FILEPATH);
       return true;
       return true;
       }
       }
     }
     }

+ 9 - 15
Source/cmFindLibraryCommand.cxx

@@ -118,14 +118,9 @@ bool cmFindLibraryCommand::InitialPass(std::vector<std::string>& args)
     }
     }
 
 
   const char* cacheValue
   const char* cacheValue
-    = cmCacheManager::GetInstance()->GetCacheValue(args[0].c_str());
+    = m_Makefile->GetDefinition(args[0].c_str());
   if(cacheValue && strcmp(cacheValue, "NOTFOUND"))
   if(cacheValue && strcmp(cacheValue, "NOTFOUND"))
     { 
     { 
-    m_Makefile->AddDefinition(args[0].c_str(), cacheValue);
-    cmCacheManager::GetInstance()->AddCacheEntry(args[0].c_str(),
-                                                 cacheValue,
-                                                 helpString.c_str(),
-                                                 cmCacheManager::FILEPATH);
     return true;
     return true;
     }
     }
 
 
@@ -137,18 +132,17 @@ bool cmFindLibraryCommand::InitialPass(std::vector<std::string>& args)
                                          path);
                                          path);
     if(library != "")
     if(library != "")
       {  
       {  
-      m_Makefile->AddDefinition(args[0].c_str(), library.c_str());  
-      cmCacheManager::GetInstance()->AddCacheEntry(args[0].c_str(),
-                                                   library.c_str(),
-                                                   helpString.c_str(),
-                                                   cmCacheManager::FILEPATH);
+      m_Makefile->AddCacheDefinition(args[0].c_str(),
+                                     library.c_str(),
+                                     helpString.c_str(),
+                                     cmCacheManager::FILEPATH);
       return true;
       return true;
       } 
       } 
     }
     }
-  cmCacheManager::GetInstance()->AddCacheEntry(args[0].c_str(),
-                                               "NOTFOUND",
-                                               helpString.c_str(),
-                                               cmCacheManager::FILEPATH);
+  m_Makefile->AddCacheDefinition(args[0].c_str(),
+                                 "NOTFOUND",
+                                 helpString.c_str(),
+                                 cmCacheManager::FILEPATH);
   return true;
   return true;
 }
 }
 
 

+ 9 - 15
Source/cmFindPathCommand.cxx

@@ -55,14 +55,9 @@ bool cmFindPathCommand::InitialPass(std::vector<std::string>& args)
   std::string helpString = "What is the path where the file ";
   std::string helpString = "What is the path where the file ";
   helpString += args[1] + " can be found";
   helpString += args[1] + " can be found";
   const char* cacheValue
   const char* cacheValue
-    = cmCacheManager::GetInstance()->GetCacheValue(args[0].c_str());
+    = m_Makefile->GetDefinition(args[0].c_str());
   if(cacheValue && strcmp(cacheValue, "NOTFOUND"))
   if(cacheValue && strcmp(cacheValue, "NOTFOUND"))
     { 
     { 
-      m_Makefile->AddDefinition(args[0].c_str(), cacheValue);
-      cmCacheManager::GetInstance()->AddCacheEntry(args[0].c_str(),
-                                                   cacheValue,
-                                                   helpString.c_str(),
-                                                   cmCacheManager::PATH);
     return true;
     return true;
     }
     }
 
 
@@ -88,19 +83,18 @@ bool cmFindPathCommand::InitialPass(std::vector<std::string>& args)
     if(cmSystemTools::FileExists(tryPath.c_str()))
     if(cmSystemTools::FileExists(tryPath.c_str()))
       {
       {
       path[k] = cmSystemTools::CollapseFullPath(path[k].c_str());
       path[k] = cmSystemTools::CollapseFullPath(path[k].c_str());
-      m_Makefile->AddDefinition(args[0].c_str(), path[k].c_str());  
-      cmCacheManager::GetInstance()->AddCacheEntry(args[0].c_str(),
-                                                   path[k].c_str(),
-                                                   helpString.c_str(),
-                                                   cmCacheManager::PATH);
+      m_Makefile->AddCacheDefinition(args[0].c_str(),
+                                     path[k].c_str(),
+                                     helpString.c_str(),
+                                     cmCacheManager::PATH);
       return true;
       return true;
       }
       }
     }
     }
   
   
-  cmCacheManager::GetInstance()->AddCacheEntry(args[0].c_str(),
-                                               "NOTFOUND",
-                                               helpString.c_str(),
-                                               cmCacheManager::PATH);
+  m_Makefile->AddCacheDefinition(args[0].c_str(),
+                                 "NOTFOUND",
+                                 helpString.c_str(),
+                                 cmCacheManager::PATH);
   return true;
   return true;
 }
 }
 
 

+ 10 - 11
Source/cmFindProgramCommand.cxx

@@ -59,10 +59,9 @@ bool cmFindProgramCommand::InitialPass(std::vector<std::string>& args)
   // Now check and see if the value has been stored in the cache
   // Now check and see if the value has been stored in the cache
   // already, if so use that value and don't look for the program
   // already, if so use that value and don't look for the program
   const char* cacheValue
   const char* cacheValue
-    = cmCacheManager::GetInstance()->GetCacheValue(define);
+    = m_Makefile->GetDefinition(define);
   if(cacheValue && strcmp(cacheValue, "NOTFOUND"))
   if(cacheValue && strcmp(cacheValue, "NOTFOUND"))
     {
     {
-    m_Makefile->AddDefinition(define, cacheValue);
     return true;
     return true;
     }
     }
   std::vector<std::string> path;
   std::vector<std::string> path;
@@ -120,18 +119,18 @@ bool cmFindProgramCommand::InitialPass(std::vector<std::string>& args)
     if(result != "")
     if(result != "")
       {
       {
       // Save the value in the cache
       // Save the value in the cache
-      cmCacheManager::GetInstance()->AddCacheEntry(define,
-                                                   result.c_str(),
-                                                   "Path to a program.",
-                                                   cmCacheManager::FILEPATH);
-      m_Makefile->AddDefinition(define, result.c_str());
+      m_Makefile->AddCacheDefinition(define,
+                                     result.c_str(),
+                                     "Path to a program.",
+                                     cmCacheManager::FILEPATH);
+      
       return true;
       return true;
       }
       }
     }
     }
-  cmCacheManager::GetInstance()->AddCacheEntry(args[0].c_str(),
-                                               "NOTFOUND",
-                                               "Path to a program",
-                                               cmCacheManager::FILEPATH);
+  m_Makefile->AddCacheDefinition(args[0].c_str(),
+                                 "NOTFOUND",
+                                 "Path to a program",
+                                 cmCacheManager::FILEPATH);
   return true;
   return true;
 }
 }
 
 

+ 1 - 1
Source/cmLinkLibrariesCommand.cxx

@@ -70,7 +70,7 @@ bool cmLinkLibrariesCommand::InitialPass(std::vector<std::string>& args)
       m_Makefile->AddLinkLibrary(i->c_str());  
       m_Makefile->AddLinkLibrary(i->c_str());  
       }
       }
 
 
-    const char* dir = cmCacheManager::GetInstance()->GetCacheValue(i->c_str());
+    const char* dir = m_Makefile->GetDefinition(i->c_str());
     if( dir )
     if( dir )
       {
       {
       m_Makefile->AddLinkDirectory( dir );
       m_Makefile->AddLinkDirectory( dir );

+ 2 - 2
Source/cmMSProjectGenerator.cxx

@@ -82,14 +82,14 @@ void cmMSProjectGenerator::SetLocal(bool local)
 void cmMSProjectGenerator::ComputeSystemInfo()
 void cmMSProjectGenerator::ComputeSystemInfo()
 {
 {
   // now load the settings
   // now load the settings
-  if(!cmCacheManager::GetInstance()->GetCacheValue("CMAKE_ROOT"))
+  if(!m_Makefile->GetDefinition("CMAKE_ROOT"))
     {
     {
     cmSystemTools::Error(
     cmSystemTools::Error(
       "CMAKE_ROOT has not been defined, bad GUI or driver program");
       "CMAKE_ROOT has not been defined, bad GUI or driver program");
     return;
     return;
     }
     }
   std::string fpath = 
   std::string fpath = 
-    cmCacheManager::GetInstance()->GetCacheValue("CMAKE_ROOT");
+    m_Makefile->GetDefinition("CMAKE_ROOT");
   fpath += "/Templates/CMakeWindowsSystemConfig.cmake";
   fpath += "/Templates/CMakeWindowsSystemConfig.cmake";
   m_Makefile->ReadListFile(NULL,fpath.c_str());
   m_Makefile->ReadListFile(NULL,fpath.c_str());
 }
 }

+ 25 - 1
Source/cmMakefile.cxx

@@ -571,12 +571,23 @@ void cmMakefile::AddIncludeDirectory(const char* inc)
     }
     }
 }
 }
 
 
+
 void cmMakefile::AddDefinition(const char* name, const char* value)
 void cmMakefile::AddDefinition(const char* name, const char* value)
 {
 {
   m_Definitions.erase( DefinitionMap::key_type(name));
   m_Definitions.erase( DefinitionMap::key_type(name));
   m_Definitions.insert(DefinitionMap::value_type(name, value));
   m_Definitions.insert(DefinitionMap::value_type(name, value));
 }
 }
 
 
+
+void cmMakefile::AddCacheDefinition(const char* name, const char* value, 
+                                    const char* doc,
+                                    cmCacheManager::CacheEntryType type)
+{
+  cmCacheManager::GetInstance()->AddCacheEntry(name, value, doc, type);
+  this->AddDefinition(name, value);
+}
+
+
 void cmMakefile::AddDefinition(const char* name, bool value)
 void cmMakefile::AddDefinition(const char* name, bool value)
 {
 {
   if(value)
   if(value)
@@ -591,6 +602,13 @@ void cmMakefile::AddDefinition(const char* name, bool value)
     }
     }
 }
 }
 
 
+
+void cmMakefile::AddCacheDefinition(const char* name, bool value, const char* doc)
+{
+  cmCacheManager::GetInstance()->AddCacheEntry(name, value, doc);
+  this->AddDefinition(name, value);
+}
+
 void cmMakefile::SetProjectName(const char* p)
 void cmMakefile::SetProjectName(const char* p)
 {
 {
   m_ProjectName = p;
   m_ProjectName = p;
@@ -769,6 +787,12 @@ void cmMakefile::ExpandVariables()
     }
     }
 }
 }
 
 
+bool cmMakefile::IsOn(const char* name)
+{
+  const char* value = this->GetDefinition(name);
+  return cmSystemTools::IsOn(value);
+}
+
 const char* cmMakefile::GetDefinition(const char* name)
 const char* cmMakefile::GetDefinition(const char* name)
 {
 {
   DefinitionMap::iterator pos = m_Definitions.find(name);
   DefinitionMap::iterator pos = m_Definitions.find(name);
@@ -776,7 +800,7 @@ const char* cmMakefile::GetDefinition(const char* name)
     {
     {
     return (*pos).second.c_str();
     return (*pos).second.c_str();
     }
     }
-  return 0;
+  return cmCacheManager::GetInstance()->GetCacheValue(name);
 }
 }
 
 
 int cmMakefile::DumpDocumentationToFile(const char *fileName)
 int cmMakefile::DumpDocumentationToFile(const char *fileName)

+ 15 - 0
Source/cmMakefile.h

@@ -47,6 +47,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "cmSystemTools.h"
 #include "cmSystemTools.h"
 #include "cmSourceGroup.h"
 #include "cmSourceGroup.h"
 #include "cmTarget.h"
 #include "cmTarget.h"
+#include "cmCacheManager.h"
+
 class cmFunctionBlocker;
 class cmFunctionBlocker;
 class cmCommand;
 class cmCommand;
 class cmMakefileGenerator;
 class cmMakefileGenerator;
@@ -213,11 +215,17 @@ public:
    * can be used in CMake to refer to lists, directories, etc.
    * can be used in CMake to refer to lists, directories, etc.
    */
    */
   void AddDefinition(const char* name, const char* value);
   void AddDefinition(const char* name, const char* value);
+  ///! Add a definition to this makefile and the global cmake cache.
+  void AddCacheDefinition(const char* name, const char* value, 
+                          const char* doc,
+                          cmCacheManager::CacheEntryType type);
 
 
   /**
   /**
    * Add bool variable definition to the build. 
    * Add bool variable definition to the build. 
    */
    */
   void AddDefinition(const char* name, bool);
   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);
 
 
   /**
   /**
    * Specify the name of the project for this build.
    * Specify the name of the project for this build.
@@ -440,8 +448,15 @@ public:
 
 
   /**
   /**
    * Given a variable name, return its value (as a string).
    * Given a variable name, return its value (as a string).
+   * If the variable is not found in this makefile instance, the
+   * cache is then queried.
    */
    */
   const char* GetDefinition(const char*);
   const char* GetDefinition(const char*);
+  
+  /** Test a boolean cache entry to see if it is true or false, 
+   *  returns false if no entry defined.
+   */
+  bool IsOn(const char* name);
 
 
   /**
   /**
    * Get a list of preprocessor define flags.
    * Get a list of preprocessor define flags.

+ 6 - 9
Source/cmOptionCommand.cxx

@@ -52,7 +52,7 @@ bool cmOptionCommand::InitialPass(std::vector<std::string>& args)
   // Now check and see if the value has been stored in the cache
   // Now check and see if the value has been stored in the cache
   // already, if so use that value and don't look for the program
   // already, if so use that value and don't look for the program
   const char* cacheValue
   const char* cacheValue
-    = cmCacheManager::GetInstance()->GetCacheValue(args[0].c_str());
+    = m_Makefile->GetDefinition(args[0].c_str());
   if(!cacheValue)
   if(!cacheValue)
     {
     {
     const char* initialValue = "Off";
     const char* initialValue = "Off";
@@ -60,17 +60,14 @@ bool cmOptionCommand::InitialPass(std::vector<std::string>& args)
       {
       {
       initialValue = args[2].c_str();
       initialValue = args[2].c_str();
       }
       }
-    cmCacheManager::GetInstance()->AddCacheEntry(args[0].c_str(),
-                                                 cmSystemTools::IsOn(initialValue),
-                                                 args[1].c_str());
-    m_Makefile->AddDefinition(args[0].c_str(), initialValue);
+    m_Makefile->AddCacheDefinition(args[0].c_str(),
+                                   cmSystemTools::IsOn(initialValue),
+                                   args[1].c_str());
     }
     }
   else
   else
     {
     {
-    m_Makefile->AddDefinition(args[0].c_str(), cacheValue);
-    cmCacheManager::GetInstance()->
-      AddCacheEntry(args[0].c_str(),
-                    cmSystemTools::IsOn(cacheValue), args[1].c_str());
+    m_Makefile->AddCacheDefinition(args[0].c_str(),
+                                   cmSystemTools::IsOn(cacheValue), args[1].c_str());
     }
     }
 
 
   return true;
   return true;

+ 6 - 12
Source/cmProjectCommand.cxx

@@ -55,18 +55,12 @@ bool cmProjectCommand::InitialPass(std::vector<std::string>& args)
   std::string srcdir = args[0];
   std::string srcdir = args[0];
   srcdir += "_SOURCE_DIR";
   srcdir += "_SOURCE_DIR";
   
   
-  m_Makefile->AddDefinition(bindir.c_str(),
-	  m_Makefile->GetCurrentOutputDirectory());
-  cmCacheManager::GetInstance()->
-    AddCacheEntry(bindir.c_str(),
-		  m_Makefile->GetCurrentOutputDirectory(),
-		  "Value Computed by CMake", cmCacheManager::STATIC);
-  m_Makefile->AddDefinition(srcdir.c_str(),
-	  m_Makefile->GetCurrentDirectory());
-  cmCacheManager::GetInstance()->
-    AddCacheEntry(srcdir.c_str(),
-		  m_Makefile->GetCurrentDirectory(),
-		  "Value Computed by CMake", cmCacheManager::STATIC);
+  m_Makefile->AddCacheDefinition(bindir.c_str(),
+                                 m_Makefile->GetCurrentOutputDirectory(),
+                                 "Value Computed by CMake", cmCacheManager::STATIC);
+  m_Makefile->AddCacheDefinition(srcdir.c_str(),
+                                 m_Makefile->GetCurrentDirectory(),
+                                 "Value Computed by CMake", cmCacheManager::STATIC);
   
   
   bindir = "PROJECT_BINARY_DIR";
   bindir = "PROJECT_BINARY_DIR";
   srcdir = "PROJECT_SOURCE_DIR";
   srcdir = "PROJECT_SOURCE_DIR";

+ 10 - 7
Source/cmSetCommand.cxx

@@ -115,7 +115,7 @@ bool cmSetCommand::InitialPass(std::vector<std::string>& args)
   m_Makefile->ExpandVariablesInString(value);
   m_Makefile->ExpandVariablesInString(value);
   // get the current cache value for the variable
   // get the current cache value for the variable
   const char* cacheValue = 
   const char* cacheValue = 
-    cmCacheManager::GetInstance()->GetCacheValue(variable);
+    m_Makefile->GetDefinition(variable);
   if(cacheValue)
   if(cacheValue)
     {
     {
     // if it is not a cached value, or it is a cached
     // if it is not a cached value, or it is a cached
@@ -126,15 +126,18 @@ bool cmSetCommand::InitialPass(std::vector<std::string>& args)
       return true;
       return true;
       }
       }
     }
     }
-  // add the definition
-  m_Makefile->AddDefinition(variable, value.c_str());
   // if it is meant to be in the cache then define it in the cache
   // if it is meant to be in the cache then define it in the cache
   if(cache)
   if(cache)
     {
     {
-    cmCacheManager::GetInstance()->AddCacheEntry(variable,
-                                                 value.c_str(),
-                                                 docstring,
-                                                 type);
+    m_Makefile->AddCacheDefinition(variable,
+                                   value.c_str(),
+                                   docstring,
+                                   type);
+    }
+  else
+    {
+    // add the definition
+    m_Makefile->AddDefinition(variable, value.c_str());
     }
     }
   return true;
   return true;
 }
 }

+ 8 - 9
Source/cmSiteNameCommand.cxx

@@ -49,19 +49,19 @@ bool cmSiteNameCommand::InitialPass(std::vector<std::string>& args)
     return false;
     return false;
     }
     }
   const char* cacheValue
   const char* cacheValue
-    = cmCacheManager::GetInstance()->GetCacheValue("SITE");
+    = m_Makefile->GetDefinition("SITE");
   if(cacheValue)
   if(cacheValue)
     {
     {
     m_Makefile->AddDefinition("SITE", cacheValue);
     m_Makefile->AddDefinition("SITE", cacheValue);
     return true;
     return true;
     }
     }
   
   
-  const char* hostname = cmCacheManager::GetInstance()->GetCacheValue("HOSTNAME");
+  const char* hostname = m_Makefile->GetDefinition("HOSTNAME");
   if(!hostname)
   if(!hostname)
     {
     {
     hostname = "hostname";
     hostname = "hostname";
     }
     }
-  const char* nslookup = cmCacheManager::GetInstance()->GetCacheValue("NSLOOKUP");
+  const char* nslookup = m_Makefile->GetDefinition("NSLOOKUP");
   if(!nslookup)
   if(!nslookup)
     {
     {
     nslookup = "nslookup";
     nslookup = "nslookup";
@@ -101,13 +101,12 @@ bool cmSiteNameCommand::InitialPass(std::vector<std::string>& args)
       }
       }
     }
     }
 
 
-  cmCacheManager::GetInstance()->
-    AddCacheEntry("SITE",
-                  siteName.c_str(),
-                  "Name of the computer/site where compile is being run",
-                  cmCacheManager::STRING);
+  m_Makefile->
+    AddCacheDefinition("SITE",
+                       siteName.c_str(),
+                       "Name of the computer/site where compile is being run",
+                       cmCacheManager::STRING);
 
 
-  m_Makefile->AddDefinition("SITE", siteName.c_str());
   return true;
   return true;
 }
 }
 
 

+ 10 - 8
Source/cmStandardIncludes.h

@@ -54,8 +54,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #ifdef _MSC_VER
 #ifdef _MSC_VER
 #pragma warning ( disable : 4786 )
 #pragma warning ( disable : 4786 )
 #pragma warning ( disable : 4503 )
 #pragma warning ( disable : 4503 )
-// for loop scoping hack
-#define for if(false) {} else for
+#define CMAKE_NO_ANSI_FOR_SCOPE
 #endif
 #endif
 
 
 #ifdef __ICL
 #ifdef __ICL
@@ -72,6 +71,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <strstream.h>
 #include <strstream.h>
 #endif
 #endif
 
 
+// we must have stl with the standard include style
 #include <vector>
 #include <vector>
 #include <string>
 #include <string>
 #include <iterator>
 #include <iterator>
@@ -81,13 +81,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <list>
 #include <list>
 #include <set>
 #include <set>
 
 
+// include the "c" string header
 #include <string.h>
 #include <string.h>
 
 
+// if std:: is not supported, then just #define it away
 #ifdef CMAKE_NO_STD_NAMESPACE
 #ifdef CMAKE_NO_STD_NAMESPACE
 #define std 
 #define std 
-#define for if(false) {} else for
 #endif
 #endif
 
 
+// if the compiler does not support ansi for scoping of vars use a 
+// #define hack
+#ifdef CMAKE_NO_ANSI_FOR_SCOPE
+#define for if(false) {} else for
+#endif
 
 
 // check for the 720 compiler on the SGI
 // check for the 720 compiler on the SGI
 // which has some strange properties that I don't think are worth
 // which has some strange properties that I don't think are worth
@@ -100,7 +106,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #  endif
 #  endif
 #endif
 #endif
 
 
-
 # ifdef CM_SGI_CC_720
 # ifdef CM_SGI_CC_720
 // the 720 sgi compiler has std:: but not for the stream library,
 // the 720 sgi compiler has std:: but not for the stream library,
 // so we have to bring it into the std namespace by hand.
 // so we have to bring it into the std namespace by hand.
@@ -124,9 +129,6 @@ inline bool operator!=(std::string const& a, const char* b)
 
 
 inline bool operator==(std::string const& a, const char* b)
 inline bool operator==(std::string const& a, const char* b)
 { return (a==std::string(b)); }
 { return (a==std::string(b)); }
-// for scoping is not ISO, so use the for hack
-#define for if(false) {} else for
-
-# endif
+# endif  // end CM_SGI_CC_720
 
 
 #endif
 #endif

+ 12 - 1
Source/cmSystemTools.cxx

@@ -643,7 +643,18 @@ void cmSystemTools::Error(const char* m1, const char* m2,
 void cmSystemTools::Message(const char* m1, const char *title)
 void cmSystemTools::Message(const char* m1, const char *title)
 {
 {
 #if defined(_WIN32) && !defined(__CYGWIN__)
 #if defined(_WIN32) && !defined(__CYGWIN__)
-  ::MessageBox(0, m1, title, MB_OK);
+  static bool disableMessages = false;
+  if(disableMessages)
+    {
+    return;
+    }
+  std::string message = m1;
+  message += "\n\n(Press  Cancel to suppress any further messages.)";
+  if(::MessageBox(0, message.c_str(), title, 
+                  MB_OKCANCEL) == IDCANCEL)
+    {
+    disableMessages = true;
+    }
 #endif
 #endif
   std::cerr << m1 << std::endl;
   std::cerr << m1 << std::endl;
 }
 }

+ 7 - 7
Source/cmUnixMakefileGenerator.cxx

@@ -555,7 +555,7 @@ void cmUnixMakefileGenerator::OutputDependencies(std::ostream& fout)
     if( ! emitted.insert(lib2->first).second ) continue;
     if( ! emitted.insert(lib2->first).second ) continue;
 
 
     const char* cacheValue
     const char* cacheValue
-      = cmCacheManager::GetInstance()->GetCacheValue(lib2->first.c_str());
+      = m_Makefile->GetDefinition(lib2->first.c_str());
     if(cacheValue )
     if(cacheValue )
       {
       {
       // if there is a cache value then this is a library that cmake
       // if there is a cache value then this is a library that cmake
@@ -587,7 +587,7 @@ void cmUnixMakefileGenerator::OutputDependencies(std::ostream& fout)
       // add the correct extension
       // add the correct extension
       std::string ltname = lib2->first+"_LIBRARY_TYPE";
       std::string ltname = lib2->first+"_LIBRARY_TYPE";
       const char* libType
       const char* libType
-        = cmCacheManager::GetInstance()->GetCacheValue(ltname.c_str());
+        = m_Makefile->GetDefinition(ltname.c_str());
       if(libType && std::string(libType) == "SHARED")
       if(libType && std::string(libType) == "SHARED")
         {
         {
         libpath += m_Makefile->GetDefinition("CMAKE_SHLIB_SUFFIX");
         libpath += m_Makefile->GetDefinition("CMAKE_SHLIB_SUFFIX");
@@ -609,7 +609,7 @@ void cmUnixMakefileGenerator::OutputDependencies(std::ostream& fout)
     if( ! emitted.insert(lib2->first).second ) continue;
     if( ! emitted.insert(lib2->first).second ) continue;
 
 
     const char* cacheValue
     const char* cacheValue
-      = cmCacheManager::GetInstance()->GetCacheValue(lib2->first.c_str());
+      = m_Makefile->GetDefinition(lib2->first.c_str());
     // if cache and not the current directory add a rule, to
     // if cache and not the current directory add a rule, to
     // jump into the directory and build for the first time
     // jump into the directory and build for the first time
     if(cacheValue 
     if(cacheValue 
@@ -621,7 +621,7 @@ void cmUnixMakefileGenerator::OutputDependencies(std::ostream& fout)
       // add the correct extension
       // add the correct extension
       std::string ltname = lib2->first+"_LIBRARY_TYPE";
       std::string ltname = lib2->first+"_LIBRARY_TYPE";
       const char* libType
       const char* libType
-        = cmCacheManager::GetInstance()->GetCacheValue(ltname.c_str());
+        = m_Makefile->GetDefinition(ltname.c_str());
       if(libType && std::string(libType) == "SHARED")
       if(libType && std::string(libType) == "SHARED")
         {
         {
         library += m_Makefile->GetDefinition("CMAKE_SHLIB_SUFFIX");
         library += m_Makefile->GetDefinition("CMAKE_SHLIB_SUFFIX");
@@ -1002,7 +1002,7 @@ void cmUnixMakefileGenerator::OutputMakeVariables(std::ostream& fout)
 void cmUnixMakefileGenerator::OutputInstallRules(std::ostream& fout)
 void cmUnixMakefileGenerator::OutputInstallRules(std::ostream& fout)
 {
 {
   const char* root
   const char* root
-    = cmCacheManager::GetInstance()->GetCacheValue("CMAKE_ROOT");
+    = m_Makefile->GetDefinition("CMAKE_ROOT");
   fout << "INSTALL = " << root << "/Templates/install-sh -c\n";
   fout << "INSTALL = " << root << "/Templates/install-sh -c\n";
   fout << "INSTALL_PROGRAM = ${INSTALL}\n";
   fout << "INSTALL_PROGRAM = ${INSTALL}\n";
   fout << "INSTALL_DATA =    ${INSTALL} -m 644\n";
   fout << "INSTALL_DATA =    ${INSTALL} -m 644\n";
@@ -1012,7 +1012,7 @@ void cmUnixMakefileGenerator::OutputInstallRules(std::ostream& fout)
   fout << "\t@echo \"Installing ...\"\n";
   fout << "\t@echo \"Installing ...\"\n";
   
   
   const char* prefix
   const char* prefix
-    = cmCacheManager::GetInstance()->GetCacheValue("CMAKE_INSTALL_PREFIX");
+    = m_Makefile->GetDefinition("CMAKE_INSTALL_PREFIX");
   if (!prefix)
   if (!prefix)
     {
     {
     prefix = "/usr/local";
     prefix = "/usr/local";
@@ -1362,7 +1362,7 @@ void cmUnixMakefileGenerator::ComputeSystemInfo()
       cmd += m_Makefile->GetHomeOutputDirectory();
       cmd += m_Makefile->GetHomeOutputDirectory();
       cmd += "; ";
       cmd += "; ";
       const char* root
       const char* root
-	= cmCacheManager::GetInstance()->GetCacheValue("CMAKE_ROOT");
+	= m_Makefile->GetDefinition("CMAKE_ROOT");
       cmd += root;
       cmd += root;
       cmd += "/Templates/configure";
       cmd += "/Templates/configure";
       cmSystemTools::RunCommand(cmd.c_str(), output);
       cmSystemTools::RunCommand(cmd.c_str(), output);

+ 9 - 12
Source/cmUtilitySourceCommand.cxx

@@ -54,7 +54,7 @@ bool cmUtilitySourceCommand::InitialPass(std::vector<std::string>& args)
   // The first argument is the cache entry name.
   // The first argument is the cache entry name.
   std::string cacheEntry = *arg++;
   std::string cacheEntry = *arg++;
   const char* cacheValue =
   const char* cacheValue =
-    cmCacheManager::GetInstance()->GetCacheValue(cacheEntry.c_str());
+    m_Makefile->GetDefinition(cacheEntry.c_str());
   // If it exists already, we are done.
   // If it exists already, we are done.
   // unless this is Major
   // unless this is Major
   if(cacheValue && 
   if(cacheValue && 
@@ -111,20 +111,17 @@ bool cmUtilitySourceCommand::InitialPass(std::vector<std::string>& args)
     +utilityName+cmSystemTools::GetExecutableExtension();
     +utilityName+cmSystemTools::GetExecutableExtension();
   
   
   // Enter the value into the cache.
   // Enter the value into the cache.
-  cmCacheManager::GetInstance()->AddCacheEntry(cacheEntry.c_str(),
-                                               utilityExecutable.c_str(),
-                                               "Path to an internal program.",
-                                               cmCacheManager::FILEPATH);
+  m_Makefile->AddCacheDefinition(cacheEntry.c_str(),
+                                 utilityExecutable.c_str(),
+                                 "Path to an internal program.",
+                                 cmCacheManager::FILEPATH);
   // add a value into the cache that maps from the
   // add a value into the cache that maps from the
   // full path to the name of the project
   // full path to the name of the project
   cmSystemTools::ConvertToUnixSlashes(utilityExecutable);
   cmSystemTools::ConvertToUnixSlashes(utilityExecutable);
-  cmCacheManager::GetInstance()->AddCacheEntry(utilityExecutable.c_str(),
-                                               utilityName.c_str(),
-                                               "Executable to project name.",
-                                               cmCacheManager::INTERNAL);
-  
-  // Set the definition in the makefile.
-  m_Makefile->AddDefinition(cacheEntry.c_str(), utilityExecutable.c_str());
+  m_Makefile->AddCacheDefinition(utilityExecutable.c_str(),
+                                 utilityName.c_str(),
+                                 "Executable to project name.",
+                                 cmCacheManager::INTERNAL);
   
   
   return true;
   return true;
 }
 }

+ 1 - 1
Source/cmVTKWrapJavaCommand.cxx

@@ -51,7 +51,7 @@ bool cmVTKWrapJavaCommand::InitialPass(std::vector<std::string>& args)
 
 
   // Now check and see if the value has been stored in the cache
   // Now check and see if the value has been stored in the cache
   // already, if so use that value and don't look for the program
   // already, if so use that value and don't look for the program
-  if(!cmCacheManager::GetInstance()->IsOn("VTK_WRAP_JAVA"))
+  if(!m_Makefile->IsOn("VTK_WRAP_JAVA"))
     {
     {
     return true;
     return true;
     }
     }

+ 1 - 1
Source/cmVTKWrapPythonCommand.cxx

@@ -51,7 +51,7 @@ bool cmVTKWrapPythonCommand::InitialPass(std::vector<std::string>& args)
 
 
   // Now check and see if the value has been stored in the cache
   // Now check and see if the value has been stored in the cache
   // already, if so use that value and don't look for the program
   // already, if so use that value and don't look for the program
-  if(!cmCacheManager::GetInstance()->IsOn("VTK_WRAP_PYTHON"))
+  if(!m_Makefile->IsOn("VTK_WRAP_PYTHON"))
     {
     {
     return true;
     return true;
     }
     }

+ 4 - 4
Source/cmVTKWrapTclCommand.cxx

@@ -49,16 +49,16 @@ bool cmVTKWrapTclCommand::InitialPass(std::vector<std::string>& args)
     return false;
     return false;
     }
     }
 
 
+  // keep the library name
+  m_LibraryName = args[0];
+
   // Now check and see if the value has been stored in the cache
   // Now check and see if the value has been stored in the cache
   // already, if so use that value and don't look for the program
   // already, if so use that value and don't look for the program
-  if(!cmCacheManager::GetInstance()->IsOn("VTK_WRAP_TCL"))
+  if(!m_Makefile->IsOn("VTK_WRAP_TCL"))
     {
     {
     return true;
     return true;
     }
     }
 
 
-  // keep the library name
-  m_LibraryName = args[0];
-
   // extract the sources and commands parameters
   // extract the sources and commands parameters
   std::vector<std::string> sources;
   std::vector<std::string> sources;
   bool doing_sources = true;
   bool doing_sources = true;

+ 1 - 0
Templates/CMakeSystemConfig.cmake.in

@@ -50,4 +50,5 @@ SET (CMAKE_X_CFLAGS           "@X_CFLAGS@" CACHE STRING "X11 extra flags")
 SET (CMAKE_HAS_X              @CMAKE_HAS_X@ CACHE INTERNAL "Is X11 around")
 SET (CMAKE_HAS_X              @CMAKE_HAS_X@ CACHE INTERNAL "Is X11 around")
 SET (CMAKE_NO_ANSI_STREAM_HEADERS @CMAKE_NO_ANSI_STREAM_HEADERS@ CACHE INTERNAL "does the compiler support headers like iostream ")
 SET (CMAKE_NO_ANSI_STREAM_HEADERS @CMAKE_NO_ANSI_STREAM_HEADERS@ CACHE INTERNAL "does the compiler support headers like iostream ")
 SET (CMAKE_NO_STD_NAMESPACE       @CMAKE_NO_STD_NAMESPACE@  CACHE INTERNAL "does the compiler support std:: ")
 SET (CMAKE_NO_STD_NAMESPACE       @CMAKE_NO_STD_NAMESPACE@  CACHE INTERNAL "does the compiler support std:: ")
+SET (CMAKE_NO_ANSI_FOR_SCOPE       @CMAKE_NO_ANSI_FOR_SCOPE@  CACHE INTERNAL "does the compiler support ansi for scoping.")
 SET (CMAKE_COMPILER_IS_GNUCXX     @CMAKE_COMPILER_IS_GNUCXX@ CACHE INTERNAL "Is the compile GNU C++")
 SET (CMAKE_COMPILER_IS_GNUCXX     @CMAKE_COMPILER_IS_GNUCXX@ CACHE INTERNAL "Is the compile GNU C++")

+ 21 - 2
Templates/configure

@@ -2961,6 +2961,24 @@ fi
 
 
 
 
 
 
+# check to see if for scoping is supported
+if test $ac_cv_prog_gxx = no; then
+  echo $ac_n "checking ansi for scope support ""... $ac_c" 1>&6
+echo "configure:2968: checking ansi for scope support " >&5 
+  rm -rf conftest.*
+  cat > conftest.cc <<!
+void foo() { for(int i;;); for(int i;;); }
+!
+  if test -z "`${CXX} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
+    echo "$ac_t""yes" 1>&6
+  else
+    CMAKE_NO_ANSI_FOR_SCOPE="1"
+    echo "$ac_t""no" 1>&6
+  fi
+fi
+
+
+
 if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
 if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
   SHLIB_CFLAGS="-fPIC"
   SHLIB_CFLAGS="-fPIC"
 fi
 fi
@@ -2971,7 +2989,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2975: checking for $ac_word" >&5
+echo "configure:2993: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_RUNMAKE'+set}'`\" = set"; then
 if eval "test \"`echo '$''{'ac_cv_path_RUNMAKE'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 else
@@ -3011,7 +3029,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3015: checking for $ac_word" >&5
+echo "configure:3033: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_CMAKE_AR_TMP'+set}'`\" = set"; then
 if eval "test \"`echo '$''{'ac_cv_path_CMAKE_AR_TMP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 else
@@ -3249,6 +3267,7 @@ s%@CMAKE_ANSI_CFLAGS@%$CMAKE_ANSI_CFLAGS%g
 s%@CMAKE_TEMPLATE_FLAGS@%$CMAKE_TEMPLATE_FLAGS%g
 s%@CMAKE_TEMPLATE_FLAGS@%$CMAKE_TEMPLATE_FLAGS%g
 s%@CMAKE_NO_STD_NAMESPACE@%$CMAKE_NO_STD_NAMESPACE%g
 s%@CMAKE_NO_STD_NAMESPACE@%$CMAKE_NO_STD_NAMESPACE%g
 s%@CMAKE_NO_ANSI_STREAM_HEADERS@%$CMAKE_NO_ANSI_STREAM_HEADERS%g
 s%@CMAKE_NO_ANSI_STREAM_HEADERS@%$CMAKE_NO_ANSI_STREAM_HEADERS%g
+s%@CMAKE_NO_ANSI_FOR_SCOPE@%$CMAKE_NO_ANSI_FOR_SCOPE%g
 s%@RUNMAKE@%$RUNMAKE%g
 s%@RUNMAKE@%$RUNMAKE%g
 s%@CMAKE_AR_TMP@%$CMAKE_AR_TMP%g
 s%@CMAKE_AR_TMP@%$CMAKE_AR_TMP%g
 s%@CMAKE_AR@%$CMAKE_AR%g
 s%@CMAKE_AR@%$CMAKE_AR%g

+ 17 - 0
Templates/configure.in

@@ -536,6 +536,23 @@ fi
 AC_SUBST(CMAKE_NO_ANSI_STREAM_HEADERS)
 AC_SUBST(CMAKE_NO_ANSI_STREAM_HEADERS)
 
 
 
 
+# check to see if for scoping is supported
+if test $ac_cv_prog_gxx = no; then
+  AC_MSG_CHECKING( ansi for scope support ) 
+  rm -rf conftest.*
+  cat > conftest.cc <<!
+void foo() { for(int i;;); for(int i;;); }
+!
+  if test -z "`${CXX} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
+    echo "$ac_t""yes" 1>&6
+  else
+    CMAKE_NO_ANSI_FOR_SCOPE="1"
+    echo "$ac_t""no" 1>&6
+  fi
+fi
+AC_SUBST(CMAKE_NO_ANSI_FOR_SCOPE)
+
+
 if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
 if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
   SHLIB_CFLAGS="-fPIC"
   SHLIB_CFLAGS="-fPIC"
 fi
 fi

+ 20 - 1
configure

@@ -983,13 +983,32 @@ EOF
   fi
   fi
 fi
 fi
 
 
+# check to see if for scoping is supported
+if test $ac_cv_prog_gxx = no; then
+  echo $ac_n "checking ansi for scope support ""... $ac_c" 1>&6
+echo "configure:990: checking ansi for scope support " >&5 
+  rm -rf conftest.*
+  cat > conftest.cc <<!
+void foo() { for(int i;;); for(int i;;); }
+!
+  if test -z "`${CXX} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
+    echo "$ac_t""yes" 1>&6
+  else
+    cat >> confdefs.h <<\EOF
+#define CMAKE_NO_ANSI_FOR_SCOPE 1
+EOF
+
+    echo "$ac_t""no" 1>&6
+  fi
+fi
+
 # find make to use to build cmake, prefer gmake
 # find make to use to build cmake, prefer gmake
 for ac_prog in gmake make
 for ac_prog in gmake make
 do
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:993: checking for $ac_word" >&5
+echo "configure:1012: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_RUNMAKE'+set}'`\" = set"; then
 if eval "test \"`echo '$''{'ac_cv_path_RUNMAKE'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
   echo $ac_n "(cached) $ac_c" 1>&6
 else
 else

+ 15 - 0
configure.in

@@ -91,6 +91,21 @@ void foo() { std::list<int> l; }
   fi
   fi
 fi
 fi
 
 
+# check to see if for scoping is supported
+if test $ac_cv_prog_gxx = no; then
+  AC_MSG_CHECKING( ansi for scope support ) 
+  rm -rf conftest.*
+  cat > conftest.cc <<!
+void foo() { for(int i;;); for(int i;;); }
+!
+  if test -z "`${CXX} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>&1`"; then
+    echo "$ac_t""yes" 1>&6
+  else
+    AC_DEFINE(CMAKE_NO_ANSI_FOR_SCOPE)
+    echo "$ac_t""no" 1>&6
+  fi
+fi
+
 # find make to use to build cmake, prefer gmake
 # find make to use to build cmake, prefer gmake
 AC_PATH_PROGS(RUNMAKE, gmake make)
 AC_PATH_PROGS(RUNMAKE, gmake make)