Build dependent targets

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Build dependent targets

Ellon Paiva
Hi,

I was wondering: is there any way to compile all targets that depend on
a given target ? (i.e. the "dependent targets", if my English does not
fail).

In my particular case, I have a huge project that contains many libs and
executables, and I would like to check that the targets that depend on
the library I'm working on do not break with my modifications, but I
wouldn't like to compile the whole project every time since not all
targets depends on my lib.

Best,

Ellon
--

Powered by kitware.com/cmake

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

Visit other Kitware open-source projects at https://www.kitware.com/platforms

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

This mailing list is deprecated in favor of https://discourse.cmake.org
Reply | Threaded
Open this post in threaded view
|

Re: Build dependent targets

Eric Noulard


Le mar. 19 nov. 2019 à 11:03, Ellon Paiva <[hidden email]> a écrit :
Hi,

I was wondering: is there any way to compile all targets that depend on
a given target ? (i.e. the "dependent targets", if my English does not
fail).

In my particular case, I have a huge project that contains many libs and
executables, and I would like to check that the targets that depend on
the library I'm working on do not break with my modifications, but I
wouldn't like to compile the whole project every time since not all
targets depends on my lib.

Correct me if I'm wrong but if you build the whole project once, then modify the lib,
the next "whole build"  should only rebuild the necessary part ? i.e. it'll rebuild
the lib and all targets that depends on it.

Do you you want to avoid building the whole project in the first place or does the 
second whole build trigger more than necessary target build?   
 


--
Eric

--

Powered by kitware.com/cmake

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

Visit other Kitware open-source projects at https://www.kitware.com/platforms

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

This mailing list is deprecated in favor of https://discourse.cmake.org
Reply | Threaded
Open this post in threaded view
|

Re: Build dependent targets

Ellon Paiva
Hi Eric,

On 11/19/19 11:10 AM, Eric Noulard wrote:


Le mar. 19 nov. 2019 à 11:03, Ellon Paiva <[hidden email]> a écrit :
Hi,

I was wondering: is there any way to compile all targets that depend on
a given target ? (i.e. the "dependent targets", if my English does not
fail).

In my particular case, I have a huge project that contains many libs and
executables, and I would like to check that the targets that depend on
the library I'm working on do not break with my modifications, but I
wouldn't like to compile the whole project every time since not all
targets depends on my lib.

Correct me if I'm wrong but if you build the whole project once, then modify the lib,
the next "whole build"  should only rebuild the necessary part ? i.e. it'll rebuild
the lib and all targets that depends on it.

Indeed, if I "whole build' once and modify the lib I would only rebuild the necessary part, except that I do not work alone on this project, and sometimes some rebase is needed to incorporate changes from other people on code not related to the lib I'm working on, and this would trigger more build than my changes would.

Also it may happen that a new dependent to the lib I'm working on may be added to the code base by one of these rebases. In this case the only way for me to check if my changes broke anything would be to do a whole build again, but this would also build many things not related to my work... I hope I'm being clear here. :-)


Do you you want to avoid building the whole project in the first place or does the 
second whole build trigger more than necessary target build?  

I would like to avoid rebuilding targets due to changes introduced by my workmates that are not related to the part of the code base I'm working on.

Best,

Ellon

 


--
Eric


--

Powered by kitware.com/cmake

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

Visit other Kitware open-source projects at https://www.kitware.com/platforms

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

This mailing list is deprecated in favor of https://discourse.cmake.org
Reply | Threaded
Open this post in threaded view
|

Re: Build dependent targets

Eric Noulard


Le mar. 19 nov. 2019 à 11:52, Ellon Paiva <[hidden email]> a écrit :
Hi Eric,

On 11/19/19 11:10 AM, Eric Noulard wrote:


Le mar. 19 nov. 2019 à 11:03, Ellon Paiva <[hidden email]> a écrit :
Hi,

I was wondering: is there any way to compile all targets that depend on
a given target ? (i.e. the "dependent targets", if my English does not
fail).

In my particular case, I have a huge project that contains many libs and
executables, and I would like to check that the targets that depend on
the library I'm working on do not break with my modifications, but I
wouldn't like to compile the whole project every time since not all
targets depends on my lib.

Correct me if I'm wrong but if you build the whole project once, then modify the lib,
the next "whole build"  should only rebuild the necessary part ? i.e. it'll rebuild
the lib and all targets that depends on it.

Indeed, if I "whole build' once and modify the lib I would only rebuild the necessary part, except that I do not work alone on this project, and sometimes some rebase is needed to incorporate changes from other people on code not related to the lib I'm working on, and this would trigger more build than my changes would.

Yes I see this is to be expected.
Avoiding this kind of rebuild may be tricky because any addition/modification of a CMakeLists.txt will trigger a CMake rerun anyway.
 
Also it may happen that a new dependent to the lib I'm working on may be added to the code base by one of these rebases. In this case the only way for me to check if my changes broke anything would be to do a whole build again, but this would also build many things not related to my work... I hope I'm being clear here. :-)

Yes you are.

I think that to achieve what you want you need to craft yourself some tooling using cmake file api.
Your tool would be able to instrospect the dependent targets using https://cmake.org/cmake/help/git-stage/manual/cmake-file-api.7.html#codemodel-version-2-target-object
and trigger the build of the list of dependent target. 

I would like to avoid rebuilding targets due to changes introduced by my workmates that are not related to the part of the code base I'm working on.

I don't know your team workflow but avoiding rebuild due to other change may reduce to avoiding rebasing you current work on top of other work?
AIFAIK each time you rebase, you may face whole rebuild, this is not really a CMake issue.

If the unwanted rebase is indeed necessary then may be your team can try to setup a shared compilation cache in order to speed-up the rebuild?
sse: https://ccache.dev/manual/latest.html#_sharing_a_cache on how to share a ccache directory.

--
Eric

--

Powered by kitware.com/cmake

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

Visit other Kitware open-source projects at https://www.kitware.com/platforms

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

This mailing list is deprecated in favor of https://discourse.cmake.org