From 86167fec4ef9d2585d1398b62f6aa33fa8bcf9a7 Mon Sep 17 00:00:00 2001
From: Zach Mullen <zach.mullen@kitware.com>
Date: Tue, 6 Oct 2009 11:46:16 -0400
Subject: [PATCH] Added better OS information for Mac OS X

---
 SystemInformation.cxx | 28 ++++++++++++++++++++++++++++
 kwsysDateStamp.cmake  |  4 ++--
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/SystemInformation.cxx b/SystemInformation.cxx
index 391a2c5..0a02c4c 100644
--- a/SystemInformation.cxx
+++ b/SystemInformation.cxx
@@ -242,6 +242,7 @@ protected:
 
   // For Mac
   bool ParseSysCtl();
+  void CallSwVers();
   kwsys_stl::string ExtractValueFromSysCtl(const char* word);
   kwsys_stl::string SysCtlBuffer;
 
@@ -3369,12 +3370,39 @@ bool SystemInformationImplementation::QueryOSInformation()
     this->OSVersion = unameInfo.version;
     this->OSPlatform = unameInfo.machine;
     }
+#ifdef __APPLE__
+  this->CallSwVers();
+#endif
 #endif
 
   return true;
 
 }
 
+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");
+  output = this->RunProcess(args);
+  this->OSName = output;
+  args.pop_back();
+
+  args.push_back("-productVersion");
+  output = this->RunProcess(args);
+  this->OSRelease = output;
+  args.pop_back();
+
+  args.push_back("-buildVersion");
+  output = this->RunProcess(args);
+  this->OSVersion = output;
+#endif
+}
+
 /** Return true if the machine is 64 bits */
 bool SystemInformationImplementation::Is64Bits()
 {
diff --git a/kwsysDateStamp.cmake b/kwsysDateStamp.cmake
index fee4324..780dd21 100644
--- a/kwsysDateStamp.cmake
+++ b/kwsysDateStamp.cmake
@@ -15,7 +15,7 @@
 SET(KWSYS_DATE_STAMP_YEAR  2009)
 
 # KWSys version date month component.  Format is MM.
-SET(KWSYS_DATE_STAMP_MONTH 09)
+SET(KWSYS_DATE_STAMP_MONTH 10)
 
 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   30)
+SET(KWSYS_DATE_STAMP_DAY   06)
-- 
GitLab