summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-09-29 14:08:04 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-09-29 14:08:04 (GMT)
commitddd082fb1fc4a771e84162bd9ef2553ef44bad7c (patch)
treeedb74192738732784a3c0b131a716688e6e8c3d8 /Modules
parent1d11f3ca68a5e4862b3641334e26d78a50cca2b4 (diff)
parent1ff96bf69c06b3cb55bd41ef1a958031d074baeb (diff)
downloadCMake-ddd082fb1fc4a771e84162bd9ef2553ef44bad7c.zip
CMake-ddd082fb1fc4a771e84162bd9ef2553ef44bad7c.tar.gz
CMake-ddd082fb1fc4a771e84162bd9ef2553ef44bad7c.tar.bz2
Merge topic 'ProcessorCount-SunOS-psrinfo'
1ff96bf6 ProcessorCount: Implement with psrinfo tool on recent SunOS versions
Diffstat (limited to 'Modules')
-rw-r--r--Modules/ProcessorCount.cmake29
1 files changed, 21 insertions, 8 deletions
diff --git a/Modules/ProcessorCount.cmake b/Modules/ProcessorCount.cmake
index 8f21adf..2c5d5ae 100644
--- a/Modules/ProcessorCount.cmake
+++ b/Modules/ProcessorCount.cmake
@@ -171,17 +171,30 @@ function(ProcessorCount var)
endif()
if(NOT count)
- # Sun (systems where uname -X emits "NumCPU" in its output):
- find_program(ProcessorCount_cmd_uname uname)
- mark_as_advanced(ProcessorCount_cmd_uname)
- if(ProcessorCount_cmd_uname)
- execute_process(COMMAND ${ProcessorCount_cmd_uname} -X
+ # Sun (systems where psrinfo tool is available)
+ find_program(ProcessorCount_cmd_psrinfo psrinfo PATHS /usr/sbin /sbin)
+ mark_as_advanced(ProcessorCount_cmd_psrinfo)
+ if (ProcessorCount_cmd_psrinfo)
+ execute_process(COMMAND ${ProcessorCount_cmd_psrinfo} -p -v
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
- OUTPUT_VARIABLE uname_X_output)
- string(REGEX MATCHALL "NumCPU = ([0-9]+)" procs "${uname_X_output}")
+ OUTPUT_VARIABLE psrinfo_output)
+ string(REGEX MATCH "([0-9]+) virtual processor" procs "${psrinfo_output}")
set(count "${CMAKE_MATCH_1}")
- #message("ProcessorCount: trying uname -X '${ProcessorCount_cmd_uname}'")
+ #message("ProcessorCount: trying psrinfo -p -v '${ProcessorCount_cmd_prvinfo}'")
+ else()
+ # Sun (systems where uname -X emits "NumCPU" in its output):
+ find_program(ProcessorCount_cmd_uname uname)
+ mark_as_advanced(ProcessorCount_cmd_uname)
+ if(ProcessorCount_cmd_uname)
+ execute_process(COMMAND ${ProcessorCount_cmd_uname} -X
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ OUTPUT_VARIABLE uname_X_output)
+ string(REGEX MATCHALL "NumCPU = ([0-9]+)" procs "${uname_X_output}")
+ set(count "${CMAKE_MATCH_1}")
+ #message("ProcessorCount: trying uname -X '${ProcessorCount_cmd_uname}'")
+ endif()
endif()
endif()