[Cmake-commits] [cmake-commits] hoffman committed SystemInformation.cxx 1.45.6.1 1.45.6.2

cmake-commits at cmake.org cmake-commits at cmake.org
Fri Oct 9 16:11:45 EDT 2009


Update of /cvsroot/CMake/CMake/Source/kwsys
In directory public:/mounts/ram/cvs-serv13963/Source/kwsys

Modified Files:
      Tag: CMake-2-8
	SystemInformation.cxx 
Log Message:
Merge in changes for RC 3


Index: SystemInformation.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/SystemInformation.cxx,v
retrieving revision 1.45.6.1
retrieving revision 1.45.6.2
diff -C 2 -d -r1.45.6.1 -r1.45.6.2
*** SystemInformation.cxx	1 Oct 2009 21:21:19 -0000	1.45.6.1
--- SystemInformation.cxx	9 Oct 2009 20:11:41 -0000	1.45.6.2
***************
*** 243,246 ****
--- 243,248 ----
    // For Mac
    bool ParseSysCtl();
+   void CallSwVers();
+   void TrimNewline(kwsys_stl::string&);
    kwsys_stl::string ExtractValueFromSysCtl(const char* word);
    kwsys_stl::string SysCtlBuffer;
***************
*** 3007,3011 ****
        {
        break;
!       }   
      if(buffer[i] != '\n' && buffer[i] != '\r')
        {
--- 3009,3013 ----
        {
        break;
!       }
      if(buffer[i] != '\n' && buffer[i] != '\r')
        {
***************
*** 3013,3017 ****
        value = buffer[i];
        value += val;
!       }          
      }
    return value;
--- 3015,3019 ----
        value = buffer[i];
        value += val;
!       }
      }
    return value;
***************
*** 3357,3360 ****
--- 3359,3368 ----
      }
    this->Hostname = name;
+   
+   const char* arch = getenv("PROCESSOR_ARCHITECTURE");
+   if(arch)
+     {
+     this->OSPlatform = arch;
+     }
  
  #else
***************
*** 3370,3373 ****
--- 3378,3384 ----
      this->OSPlatform = unameInfo.machine;
      }
+ #ifdef __APPLE__
+   this->CallSwVers();
+ #endif
  #endif
  
***************
*** 3376,3379 ****
--- 3387,3439 ----
  }
  
+ void SystemInformationImplementation::CallSwVers()
+ {
+ #ifdef __APPLE__
+   kwsys_stl::string output;
+   kwsys_stl::vector<const char*> args;
+   args.clear();
+   
+   args.push_back("sw_vers");
+   args.push_back("-productName");
+   args.push_back(0);
+   output = this->RunProcess(args);
+   this->TrimNewline(output);
+   this->OSName = output;
+   args.clear();
+ 
+   args.push_back("sw_vers");
+   args.push_back("-productVersion");
+   args.push_back(0);
+   output = this->RunProcess(args);
+   this->TrimNewline(output);
+   this->OSRelease = output;
+   args.clear();
+ 
+   args.push_back("sw_vers");
+   args.push_back("-buildVersion");
+   args.push_back(0);
+   output = this->RunProcess(args);
+   this->TrimNewline(output);
+   this->OSVersion = output;
+ #endif
+ }
+ 
+ void SystemInformationImplementation::TrimNewline(kwsys_stl::string& output)
+ {  
+   // remove \r
+   kwsys_stl::string::size_type pos=0;
+   while((pos = output.find("\r", pos)) != kwsys_stl::string::npos)
+     {
+     output.erase(pos);
+     }
+ 
+   // remove \n
+   pos = 0;
+   while((pos = output.find("\n", pos)) != kwsys_stl::string::npos)
+     {
+     output.erase(pos);
+     }
+ }
+ 
  /** Return true if the machine is 64 bits */
  bool SystemInformationImplementation::Is64Bits()



More information about the Cmake-commits mailing list