[CMake] Getting the number of processor
Eric Noulard
eric.noulard at gmail.com
Tue Jun 3 14:46:01 EDT 2008
2008/6/3 Mathieu Malaterre <mathieu.malaterre at gmail.com>:
> Goal: be able to automate the -j flag option for make. In my ctest
> script I would say:
>
> ...
> IF("Unix Makefiles")
> GET_NUMBER_OF_PROCESSORS(numproc)
> SET(option "-j${numproc}")
> ENDIF("Unix Makefiles")
> ...
If you are using GNU make may be you can let make handle the load with
make -j -l 4.0
see:
-l [load], --load-average[=load]
Specifies that no new jobs (commands) should be started if there
are others jobs running and the load average is at least load (a
floating-point number). With no argument, removes a previous load
limit.
I think it would be more effective in you goal is to speed-up the build.
I know I'm not really answering the question but :=)
--
Erk
More information about the CMake
mailing list