Hi, CMake adds order-only dependencies in build.ninja between libraries and subsequent object-files, and I cannot see why this is needed. Consider the following CMakeLists.txt:
project( program ) add_library( A SHARED a.cc ) add_library( B SHARED b.cc ) target_link_libraries( B A ) add_executable( prog program.cc ) target_link_libraries( prog B ) There are a couple of targets generated: a.cc.o, b.cc.o, libA.so, libB.so, prog.cc.o and prog. The ninja-file will make these targets be built in the following steps: 1. a.cc.o 2. libA.so 3. b.cc.o 4. libB.so 5. prog.cc.o 6. prog My point is that there is no reason to wait building b.cc.o and prog.cc.o; they can be built at the same time as a.cc.o . Hence I wonder why libA.so is added as a order-only dependency to b.cc.o when CMake processes this? This is done in Source/cmNinjaTargetGenerator.cxx:509 (in v2.8.12), line 548 in v3. The call is: // Ensure that the target dependencies are built before any source file in // the target, using order-only dependencies. cmNinjaDeps orderOnlyDeps; this->GetLocalGenerator()->AppendTargetDepends(this->Target, orderOnlyDeps); I'm trying to trim a few minutes on our continuous build, and my build system goes into singlethreadedness while libA is linked, while my 64 cores could be compiling object-files for libB and other targets. Simply commenting out the statement above solves it for me. At least in my project, I cannot see a reason for this rule. Perhaps a variable could be introduced to steer the behaviour if it is needed elsewhere. Any thought is welcome, and I'm willing to submit a patch if a consensus could be reached on what to do. Cheers, Kristofer
-- 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