Do transitive dependencies reduce number of jobs that can be compiled in parallel?

If I have two libraries A and B, with an executable C, whose dependencies are described by:

  add_library(A ${A_SRC})

  add_library(B ${B_SRC})
  target_link_libraries(B A)

  add_executable(C ${C_SRC})
  target_link_libraries(C B)

I understand that when *linking* C, the transitive dependency A will be added. However, if I build C in parallel "make -j N", will CMake build libraries A and B simultaneously, or fully compile and link A before starting compilation of B? I.e. just because the link steps are serial dependencies, are the compilation steps? Would it be faster to do:

  add_library(A ${A_SRC})

  add_library(B ${B_SRC})

  add_executable(C ${C_SRC})
  target_link_libraries(C B A)

Thanks.
--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to