On 03/14/2016 07:39 PM, Matthias Männich wrote:
> increase build parallelism by omitting dependencies of object file
> targets to the libraries they will be linked with in a later step.

Nice.  I like the idea of doing that, but I think it can be made
automatic and safe without an explicit option with a bit more work.
Let's see how far we can get without resorting to an explicit option.
It would be nice to avoid an option because then every project can
benefit immediately and we do not have to worry about accidentally
breaking dependencies by activating the option incorrectly.

The only reason we make object compilations order-only depend on
target-level dependencies is to support generated header files and
other custom command outputs.  For example:

  add_custom_command(OUTPUT foo.h ...)
  add_library(foo foo.c foo.h)
  add_library(bar bar.c)
  target_link_libraries(bar foo)

The order-only dependency of `bar.c.o` on the target `foo` is just
in case `bar.c` needs to include `foo.h`.  It is a conservative
approach and does generate many unneeded dependencies in practice.

With a bit of analysis the Ninja generator could detect when `foo`
has no custom commands and does not have a target-level dependency
on other targets with custom commands.  Then dependencies on `foo`
from compilations in `bar` could be omitted automatically.

Thanks,
-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