- if [ -f "${cpuinfo_file}" ]; then
- NUMBER_OF_PROCESSORS=$(grep -c "processor.: " ${cpuinfo_file})
- fi
- # grep returns 0 or cpuinfo not found
- if [ $NUMBER_OF_PROCESSORS = 0 ]; then
- NUMBER_OF_PROCESSORS=1
- fi
-
- cmake $WORKSPACE
+ NUMBER_OF_PROCESSORS=$(lscpu -p 2>/dev/null | grep -c '^[^#]') || \
+ NUMBER_OF_PROCESSORS=$(grep -c "^processor[[:space:]]*:" ${cpuinfo_file} 2>/dev/null)
+ [ "0$NUMBER_OF_PROCESSORS" -gt 0 ] || NUMBER_OF_PROCESSORS=1