On 05/18/2017 05:48 PM, Robert Patterson via cmake-developers wrote:
>  we must have a preprocessing step (makedepend or gcc -M) 

Where in your example(s) does this step take place?

> 'make' has a limitation where if 'make target1 target2 target3' is invoked,
> target1, target2, and target3 are built serially, not in parallel.

I don't think that is a limitation of `make`, but rather of CMake's
generated makefiles.  The `Makefile` files in the build tree work
internally in such a way that only one target can be built from the
command-line at a time, so they contain a `.NOTPARALLEL` mark to tell
GNU make to act serially.

> To get around this, we decided that the best option was to dynamically
> create a new [cmake] target which depends on the affected targets.

Another approach is to use `CMakeFiles/Makefile2` directly:

  make cmake_check_build_system
  make -j -f CMakeFiles/Makefile2 dir1/tgt1.dir/all dir2/tgt2.dir/all 
dir3/tgt3.dir/all

This will build all of the targets in parallel safely.  The difficulty
will be in constructing the paths to these per-target `/all` make targets.
Maybe some changes to the Unix Makefiles generator could relieve that.

Or, we could just expose an alternative entry point in the Makefile files.
It is likely not too hard to get the following to work:

  make -j cmake_targets_variable TARGETS="tgt1 tgt2 tgt3"

-Brad

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to