From c3e238dd538322268a4475ac4454b35fe39a134e Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Fri, 28 Mar 2014 17:59:31 +0100 Subject: [PATCH] ProcessorCount: use mpsched on HPUX if machinfo is not present Co-Author: Gerhard Grimm --- Modules/ProcessorCount.cmake | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Modules/ProcessorCount.cmake b/Modules/ProcessorCount.cmake index 0fe0b3207c..e034a28a37 100644 --- a/Modules/ProcessorCount.cmake +++ b/Modules/ProcessorCount.cmake @@ -104,6 +104,18 @@ function(ProcessorCount var) string(REGEX MATCHALL "Number of CPUs = ([0-9]+)" procs "${machinfo_output}") set(count "${CMAKE_MATCH_1}") #message("ProcessorCount: trying machinfo '${ProcessorCount_cmd_machinfo}'") + else() + find_program(ProcessorCount_cmd_mpsched mpsched) + mark_as_advanced(ProcessorCount_cmd_mpsched) + if(ProcessorCount_cmd_mpsched) + execute_process(COMMAND ${ProcessorCount_cmd_mpsched} -s + OUTPUT_QUIET + ERROR_STRIP_TRAILING_WHITESPACE + ERROR_VARIABLE mpsched_output) + string(REGEX MATCHALL "Processor Count *: *([0-9]+)" procs "${mpsched_output}") + set(count "${CMAKE_MATCH_1}") + #message("ProcessorCount: trying mpsched -s '${ProcessorCount_cmd_mpsched}'") + endif() endif() endif()