diff --git a/CMakeLists.txt b/CMakeLists.txt
index ccdff12559beef5278a2b340569865e88683d5cf..6bfcab040dc237c20aa3acd07b75587086fc9284 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -596,6 +596,13 @@ IF(KWSYS_USE_SystemInformation)
       ENDIF()
     ENDIF()
   ENDIF()
+  IF(CMAKE_SYSTEM MATCHES "HP-UX")
+    CHECK_INCLUDE_FILES("sys/mpctl.h" KWSYS_SYS_HAS_MPCTL_H)
+    IF(KWSYS_SYS_HAS_MPCTL_H)
+      SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
+        COMPILE_DEFINITIONS KWSYS_SYS_HAS_MPCTL_H=1)
+    ENDIF()
+  ENDIF()
   IF(KWSYS_LFS_AVAILABLE AND NOT KWSYS_LFS_DISABLE)
     SET(KWSYS_PLATFORM_CXX_TEST_DEFINES -DKWSYS_HAS_LFS=1)
   ENDIF()
diff --git a/SystemInformation.cxx b/SystemInformation.cxx
index b418e12959158e49a2e84a6f4a1638ebbf70ccd1..efcd8cc9916fb2112d4137776dedf73e88ad70a9 100644
--- a/SystemInformation.cxx
+++ b/SystemInformation.cxx
@@ -142,6 +142,9 @@ typedef struct rlimit ResourceLimitType;
 #elif defined( __hpux )
 # include <sys/param.h>
 # include <sys/pstat.h>
+# if defined(KWSYS_SYS_HAS_MPCTL_H)
+#  include <sys/mpctl.h>
+# endif
 #endif
 
 #ifdef __HAIKU__
@@ -461,6 +464,9 @@ protected:
   bool QueryBSDMemory();
   bool QueryBSDProcessor();
 
+  //For HP-UX
+  bool QueryHPUXProcessor();
+
   // Evaluate the memory information.
   int QueryMemory();
   size_t TotalVirtualMemory;
@@ -1272,6 +1278,8 @@ void SystemInformationImplementation::RunCPUCheck()
   this->QueryQNXProcessor();
 #elif defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
   this->QueryBSDProcessor();
+#elif defined(__hpux)
+  this->QueryHPUXProcessor();
 #else
   this->RetreiveInformationFromCpuInfoFile();
 #endif
@@ -4267,6 +4275,28 @@ bool SystemInformationImplementation::QueryBSDProcessor()
 #endif
 }
 
+bool SystemInformationImplementation::QueryHPUXProcessor()
+{
+#if defined(__hpux)
+# if defined(KWSYS_SYS_HAS_MPCTL_H)
+  int c = mpctl(MPC_GETNUMSPUS_SYS, 0, 0);
+  if (c <= 0)
+    {
+    return false;
+    }
+
+  this->NumberOfPhysicalCPU = c;
+  this->NumberOfLogicalCPU = this->NumberOfPhysicalCPU;
+
+  return true;
+# else
+  return false;
+# endif
+#else
+  return false;
+#endif
+}
+
 /** Query the operating system information */
 bool SystemInformationImplementation::QueryOSInformation()
 {