Fix number processors on mac for parallelizing ctest
system_profiler takes too long on my machine and the string regex replace doesn't work correctly (cmake 3.3.1)release/4.3a0
parent
94e8f7073c
commit
5ba04bba44
|
|
@ -112,11 +112,10 @@ if(NOT DEFINED PROCESSOR_COUNT)
|
||||||
|
|
||||||
# Mac:
|
# Mac:
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
find_program(cmd_sys_pro "system_profiler")
|
find_program(cmd_sysctl "sysctl")
|
||||||
if(cmd_sys_pro)
|
if(cmd_sysctl)
|
||||||
execute_process(COMMAND ${cmd_sys_pro} OUTPUT_VARIABLE info)
|
execute_process(COMMAND ${cmd_sysctl} -n hw.ncpu OUTPUT_VARIABLE info)
|
||||||
string(REGEX REPLACE "^.*Total Number Of Cores: ([0-9]+).*$" "\\1"
|
string(STRIP ${info} PROCESSOR_COUNT)
|
||||||
PROCESSOR_COUNT "${info}")
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue