[CMake] How would I use parallel make on ExternalProjects?
kent williams
nkwmailinglists at gmail.com
Thu Oct 7 12:13:34 EDT 2010
On Thu, Oct 7, 2010 at 11:05 AM, Bill Hoffman <bill.hoffman at kitware.com> wrote:
>
> What you want is for make to treat the external projects just like any other
> library or executable in a build.
>
> so, if you run this at the top of the build:
>
> make -j4
>
> It should run at most 4 concurrent things at once for the whole thing. By
> using $(MAKE) in the makefiles make will do that.
>
There is one problem with that, which is what I'm trying to address:
load balancing. If your project builds ITK, VTK, and sundry other
prerequisite libraries, it will spawn 4 sequential builds. In
practice this means everything except ITK (which we build with
wrapping on) finishes, and then ITK chugs along doing its sequential
build.
If I do what I'm talking about, I'd sequentially conduct parallel
builds of ITK VTK etc. In which case the big hairy libraries, like
ITK with wrapping, get built in parallel.
> That said, CMake will do this by default for make based builds and external
> projects now.
>
> From ExternalProject.cmake:
>
> get_target_property(cmake_generator ${name} _EP_CMAKE_GENERATOR)
> if("${CMAKE_GENERATOR}" MATCHES "Make" AND
> ("${cmake_generator}" STREQUAL "${CMAKE_GENERATOR}" OR
> NOT cmake_generator))
> # The project uses the same Makefile generator. Use recursive make.
> set(cmd "$(MAKE)")
> if(step STREQUAL "INSTALL")
> set(args install)
> endif()
>
>
> -Bill
>
More information about the CMake
mailing list