[CMake] Two phase install?

Scott Aron Bloom scott at towel42.com
Wed Mar 23 23:53:01 EDT 2016


> Thanks I'm getting close now.
>
> However, for the two sub projects, there doesn’t seem to be a way to run the make stage with -j 6 or any make options.
>
> Am I missing something? I see how to set CMAKE_ARGS but no MAKE_ARGS

Hi Scott:

Some of my further comments are somewhat off your original topic since I discuss parallel build issues for the case of larger numbers of projects in the superproject, but I thought you might be interested in that case even though you just have two projects in your superproject.

For the superproject (epa_build in my case) I configure the EPA_PARALLEL_BUILD_COMMAND variable to create the build command that I use for all individual projects.  That can be anything accessible from the command-line such as nmake in the Windows case and make in the Unix case.  So in your case, your overall superproject could specify

set(SUPERPROJECT_BUILD_COMMAND make -j4)

(say), and then each of your two projects could be configured via ExternalProject_Add to use ${SUPERPROJECT_BUILD_COMMAND} as the build command for each individual project.  But getting back to the more complex case, for Unix on Windows (e.g. Cygwin, MinGW-w64/MSYS2,
MinGW/MSYS) I find parallel build options are not reliable (presumably because of make bugs in all those platforms) so to work around that issue, epa_build deliberately drops any -j options that might be specified in EPA_PARALLEL_BUILD_COMMAND for those platforms.  But for the Linux case (and I assume Mac OS X, also although I haven't tried it yet), the -j option for make does work reliably so I allow that option to be part of the EPA_PARALLEL_BUILD_COMMAND for that platform.

N.B. with 60 projects being built (each one using a parallel build on
Linux) with one overall make command, I am currently careful to build each of those projects one at a time (i.e., avoid any parallel options on the overall build or just use -j1) to avoid overwhelming my computer with parallel builds.  However, come to think of it I have always used that combination of -j options (-j4 for individual project builds and -j1 for overall build) out of inertia, and there are many other ways that avoidance can be done (e.g., -j4 on the overall build and -j1 on the individual builds) so long as the product of the two integers specified by the -j options does not get too excessive.  So I may do some experimentation concerning the most efficient combination of individual and overall -j options the next time I do an epa_build on Linux.

Alan

==========
Thanks that  is what I was planning.  I was just hoping, there was a variable I was missing in the docs

I have it working now on linux, off to try and see how it works with windows

Scott



More information about the CMake mailing list