[CMake] How would I use parallel make on ExternalProjects?

David Cole david.cole at kitware.com
Thu Oct 7 11:55:50 EDT 2010


If you use "$(MAKE)" in a BUILD_COMMAND, then the literal "$(MAKE)" appears
in the generated makefiles.

That tells the top level make to spawn sub-makes with the job controller
from the top level make.

Then you do not need to specify any -j flags anywhere except at the top
level.

And then, the top level job controller makes sure there are only N
concurrent things happening regardless of the level of sub-makes...

Does that "make" sense?


:-)
David


On Thu, Oct 7, 2010 at 11:52 AM, kent williams <nkwmailinglists at gmail.com>wrote:

> 1. Is that $(MAKE) or is it ${MAKE} ?  One thing missing from the
> CMake documentation -- unless I'm mistaken there's not much
> explanation of CMake syntax in the documentation.
>
> 2. I think it's probably not what one intends to have 'make -j4' (for
> example) used every time make is invoked.  If you configure a program
> that includes several ExternalProjects, then it would spawn 4
> concurrent builds of those ExternalProjects, and then each of those
> builds would spawn 4 make steps at once, for 16 concurrent processes.
>
>
> On Thu, Oct 7, 2010 at 10:36 AM, Bill Hoffman <bill.hoffman at kitware.com>
> wrote:
> > On 10/7/2010 11:25 AM, kent williams wrote:
> >>
> >> On Wed, Oct 6, 2010 at 5:01 PM, Clifford Yapp<cliffyapp at gmail.com>
>  wrote:
> >>>
> >>> I use $(MAKE) in my BUILD_COMMAND and that seems to do OK, although I
> >>> don't know if it works universally.
> >>>
> >>
> >> That's an environment variable, as near as I can tell and isn't
> >> mentioned in the current CMake documentation. So it's probably not the
> >> best thing to do.
> >>
> >> upon reflection, this would be a little safer:
> >>
> >> if("${CMAKE_GENERATOR}" STREQUAL "Unix Makefiles")
> >> set(BUILD_COMMAND_STRING "${CMAKE_MAKE_PROGRAM} -j4")
> >> else()
> >> set(BUILD_COMMAND_STRING "$(CMAKE_MAKE_PROGRAM)")
> >> endif()
> >
> > By using $(MAKE), the toplevel -j N option should be passed down.  The
> 2.8.3
> > RC that is out now has some fixes in this area.
> >
> >
> > -Bill
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20101007/f5e318f0/attachment.htm>


More information about the CMake mailing list