[CMake] Getting the number of processor

David Cole david.cole at kitware.com
Tue Jun 3 11:03:31 EDT 2008


(1) What contents are in /proc/cpuinfo?
(2) What are you getting as output when you use this CMake code?
(3) What do you expect to get?



On Fri, May 30, 2008 at 12:33 PM, Mathieu Malaterre <
mathieu.malaterre at gmail.com> wrote:

> regex are driving me nuts... could someone please let me know what is
> wrong with my 'REPLACE' expression.
>
> Thanks !
>
> FILE(READ /proc/cpuinfo cpuinfo)
> STRING(REGEX REPLACE "\r?\n" ";" cpuinfo "${cpuinfo}")
> SET(myoutput "")
>
> FOREACH(line ${cpuinfo})
>  STRING(REGEX MATCH "processor" proc_line ${line})
>  STRING(REGEX REPLACE
>    "^processor[ ]+:[ ]+([0-9]+)$"
>    " \\1 " nline "${line}")
>  IF(proc_line)
>  MESSAGE(${nline})
>    SET(myoutput "${myoutput}\n${nline}")
>  ENDIF(proc_line)
> ENDFOREACH(line)
>
> MESSAGE("${myoutput}")
>
> --
> Mathieu
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080603/9a842e7f/attachment.htm>


More information about the CMake mailing list