[CMake] Parallel builds and Eclipse CDT4 generator

Timothy M. Shead tshead at sandia.gov
Thu Mar 12 15:57:52 EDT 2009


Alexander Neundorf wrote:
> On Thursday 12 March 2009, Adolfo Rodríguez wrote:
>> We currently use three of CMake's generators: "Unix Makefiles",
>> "KDevelop3", and "Eclipse CDT4 - Unix Makefiles", and we're interested in
>> doing parallel builds. Doing so with makefiles is trivial (make -j#), as
>> well as with KDevelop3 (only _one_ parameter must be edited in the build
>> options of the project). However Eclipse is still eluding me (I must
>> confess that I'm quite new to it).
>> My current hack is to edit individual targets and change the name of the
>> target from, say 'all' to '-j# all', and it works. However, I haven't found
>> a project-wide policy that if edited once, will affect all targets. I
>> cannot set the default build command, because apparently CMake generates
>> each target with a custom build command.
>>
>> Any clues from the CMake-Eclipse experts?
>>
>> I'm using CMake 2.6.2 and Eclipse CDT5 (not CDT4, could this be an issue?)
> 
> I don't think so.
> We could add some special variable, like
> CMAKE_MAKEFILE_PROJECT_FLAGS or CMAKE_MAKEFILE_PARALLELITY, and use this in 
> the makefile-based generators to set the "-jx" parameter for make.
> But then again, this shouldn't be hardcoded in the CMakeLists.txt, so it could 
> only be a cache variable.
> Or should cmake try to determine automatically how many cores there are and 
> add "-jx" automatically ? E.g. using sysconf(_SC_NPROCESSORS_ONLN) ?
> This could also be disabled by default and enabled e.g. via an option like 
> CMAKE_AUTOMATIC_PARALLEL_MAKE_INVOCATION or something like this.

I believe that this must be configurable - using distcc, developers may 
want to build with -jx > the number of local cores.

Cheers,
Tim

-- 
Timothy M. Shead
Data Analysis & Visualization (1424)
Sandia National Laboratories
505-284-0139



More information about the CMake mailing list