[Cmake-commits] CMake branch, next, updated. v2.8.3-549-g25be1b0

David Cole david.cole at kitware.com
Fri Nov 5 16:03:44 EDT 2010


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  25be1b070297dea7def03bf95009c752426c54ab (commit)
       via  1f5644e1142a39440e5914ed6d817bf0ae23173a (commit)
      from  7d4364315d71729b2031a0a9e98c1866f994faeb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=25be1b070297dea7def03bf95009c752426c54ab
commit 25be1b070297dea7def03bf95009c752426c54ab
Merge: 7d43643 1f5644e
Author:     David Cole <david.cole at kitware.com>
AuthorDate: Fri Nov 5 16:03:42 2010 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Nov 5 16:03:42 2010 -0400

    Merge topic 'add-ProcessorCount-module' into next
    
    1f5644e If getconf returns empty output, try cpuinfo. (#11302)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1f5644e1142a39440e5914ed6d817bf0ae23173a
commit 1f5644e1142a39440e5914ed6d817bf0ae23173a
Author:     David Cole <david.cole at kitware.com>
AuthorDate: Fri Nov 5 15:57:21 2010 -0400
Commit:     David Cole <david.cole at kitware.com>
CommitDate: Fri Nov 5 16:00:57 2010 -0400

    If getconf returns empty output, try cpuinfo. (#11302)
    
    Also, add message output (temporarily) for gathering data
    on all the dashboard machines. After the test runs on the
    overnight dashboards tonight, I'll comment out the message
    output and commit/push again.

diff --git a/Modules/ProcessorCount.cmake b/Modules/ProcessorCount.cmake
index b46a012..5ccfbff 100644
--- a/Modules/ProcessorCount.cmake
+++ b/Modules/ProcessorCount.cmake
@@ -30,6 +30,7 @@ function(ProcessorCount var)
   if(WIN32)
     # Windows:
     set(count "$ENV{NUMBER_OF_PROCESSORS}")
+    message("ProcessorCount: using environment variable")
   elseif(APPLE)
     # Mac:
     find_program(ProcessorCount_cmd_sysctl sysctl
@@ -38,21 +39,29 @@ function(ProcessorCount var)
       execute_process(COMMAND ${ProcessorCount_cmd_sysctl} -n hw.ncpu
         OUTPUT_STRIP_TRAILING_WHITESPACE
         OUTPUT_VARIABLE count)
+      message("ProcessorCount: using sysctl '${ProcessorCount_cmd_sysctl}'")
     endif()
   else()
+    # Linux (and other systems with getconf):
     find_program(ProcessorCount_cmd_getconf getconf)
     if(ProcessorCount_cmd_getconf)
-      # Linux and other systems with getconf:
       execute_process(COMMAND ${ProcessorCount_cmd_getconf} _NPROCESSORS_ONLN
         OUTPUT_STRIP_TRAILING_WHITESPACE
         OUTPUT_VARIABLE count)
-    else()
-      # Linux and other systems with /proc/cpuinfo:
-      set(cpuinfo_file /proc/cpuinfo)
-      if(EXISTS "${cpuinfo_file}")
-        file(STRINGS "${cpuinfo_file}" procs REGEX "^processor.: [0-9]+$")
-        list(LENGTH procs count)
-      endif()
+      message("ProcessorCount: using getconf '${ProcessorCount_cmd_getconf}'")
+    endif()
+  endif()
+
+  # Execute this code when there is no 'sysctl' or 'getconf' or
+  # when previously executed methods return empty output:
+  #
+  if(NOT count)
+    # Systems with /proc/cpuinfo:
+    set(cpuinfo_file /proc/cpuinfo)
+    if(EXISTS "${cpuinfo_file}")
+      file(STRINGS "${cpuinfo_file}" procs REGEX "^processor.: [0-9]+$")
+      list(LENGTH procs count)
+      message("ProcessorCount: using cpuinfo '${cpuinfo_file}'")
     endif()
   endif()
 

-----------------------------------------------------------------------

Summary of changes:
 Modules/ProcessorCount.cmake |   25 +++++++++++++++++--------
 1 files changed, 17 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list