[Cmake] Patch for at command-line parm

Schumacher, Gordon gordon_schumacher at maxtor.com
Fri, 7 May 2004 12:32:00 -0600


Sorry this took me so long; it's been pretty crazy here.

Anyway, this should do it... let me know if you run into problems with this.

Next stop: trying to build a version of CMake that will run under DJGPP!
(Yes, I'm insane.  But I've not been left much choice on this one... we
probably *have* to be able to build in a real DOS environment!  Yuck.)

Patch follows:
---------------

diff -r -w -u -x CVS -x '*.bak' CMake.orig/Source/cmake.cxx
CMake/Source/cmake.cxx
--- CMake.orig/Source/cmake.cxx	2004-04-29 08:26:22.000000000 -0600
+++ CMake/Source/cmake.cxx	2004-04-30 17:20:58.000000000 -0600
 at  at  -265,7 +265,7  at  at 
 }
 
 // Parse the args
-void cmake::SetArgs(const std::vector<std::string>& args)
+void cmake::SetArgs(std::vector<std::string>& args)
 {
   m_Local = false;
   bool directoriesSet = false;
 at  at  -341,6 +341,32  at  at 
         this->SetGlobalGenerator(gen);
         }
       }
+	 else if(arg.find(" at ",0) == 0)
+	   {
+        std::string filename = arg.substr(1);
+        std::cout << "reading from " << filename << '\n';
+
+        filename = cmSystemTools::CollapseFullPath(filename.c_str());
+        cmSystemTools::ConvertToUnixSlashes(filename);
+		if(cmSystemTools::FileExists(filename.c_str()))
+        {
+        std::ifstream fin(filename.c_str());
+        std::string   next_filearg;
+        while (fin)
+          {
+          fin >> next_filearg;
+          if (!next_filearg.empty())
+            {
+            args.push_back(next_filearg);
+            }
+          }
+        }
+      else
+        {
+        cmSystemTools::Error("Could not open command line file",
+                             filename.c_str());
+        }
+      }
     // no option assume it is the path to the source
     else
       {
 at  at  -1139,7 +1165,7  at  at 
 }
 
 // handle a command line invocation
-int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
+int cmake::Run(std::vector<std::string>& args, bool noconfigure)
 {
   // Process the arguments
   this->SetArgs(args);
diff -r -w -u -x CVS -x '*.bak' CMake.orig/Source/cmake.h
CMake/Source/cmake.h
--- CMake.orig/Source/cmake.h	2004-04-26 09:23:06.000000000 -0600
+++ CMake/Source/cmake.h	2004-04-30 17:13:18.000000000 -0600
 at  at  -122,9 +122,9  at  at 
   /**
    * Handle a command line invocation of cmake.
    */
-  int Run(const std::vector<std::string>&args)
+  int Run(std::vector<std::string>&args)
     { return this->Run(args, false); }
-  int Run(const std::vector<std::string>&args, bool noconfigure);
+  int Run(std::vector<std::string>&args, bool noconfigure);
 
   /**
    * Generate the SourceFilesList from the SourceLists. This should only be
 at  at  -212,7 +212,7  at  at 
   void Usage(const char *program);
 
   ///! Parse command line arguments
-  void SetArgs(const std::vector<std::string>&);
+  void SetArgs(std::vector<std::string>&);
 
   ///! Is this cmake running as a result of a TRY_COMPILE command
   bool GetIsInTryCompile() { return m_InTryCompile; }
diff -r -w -u -x CVS -x '*.bak' CMake.orig/Source/cmakewizard.cxx
CMake/Source/cmakewizard.cxx
--- CMake.orig/Source/cmakewizard.cxx	2003-08-26 13:06:52.000000000 -0600
+++ CMake/Source/cmakewizard.cxx	2004-04-29 19:36:48.000000000 -0600
 at  at  -89,7 +89,7  at  at 
 
 
 
-int cmakewizard::RunWizard(std::vector<std::string> const& args)
+int cmakewizard::RunWizard(std::vector<std::string>& args)
 {
   m_ShowAdvanced = this->AskAdvanced();
   cmSystemTools::DisableRunCommandOutput();
diff -r -w -u -x CVS -x '*.bak' CMake.orig/Source/cmakewizard.h
CMake/Source/cmakewizard.h
--- CMake.orig/Source/cmakewizard.h	2003-08-26 13:06:52.000000000 -0600
+++ CMake/Source/cmakewizard.h	2004-04-29 19:37:04.000000000 -0600
 at  at  -38,7 +38,7  at  at 
    *  Run cmake in wizard mode.  This will coninue to ask the user
questions 
    *  until there are no more entries in the cache.
    */
-  int RunWizard(std::vector<std::string>const& args);
+  int RunWizard(std::vector<std::string>& args);
   
 private:
   bool m_ShowAdvanced;