<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mar. 19 nov. 2019 à 11:52, Ellon Paiva <<a href="mailto:ellonpaiva@gmail.com">ellonpaiva@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div>
    Hi Eric,<br>
    <br>
    <div>On 11/19/19 11:10 AM, Eric Noulard
      wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">
        <div dir="ltr"><br>
        </div>
        <br>
        <div class="gmail_quote">
          <div dir="ltr" class="gmail_attr">Le mar. 19 nov. 2019
            à 11:03, Ellon Paiva <<a href="mailto:ellonpaiva@gmail.com" target="_blank">ellonpaiva@gmail.com</a>>
            a écrit :<br>
          </div>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
            <br>
            I was wondering: is there any way to compile all targets
            that depend on <br>
            a given target ? (i.e. the "dependent targets", if my
            English does not <br>
            fail).<br>
            <br>
            In my particular case, I have a huge project that contains
            many libs and <br>
            executables, and I would like to check that the targets that
            depend on <br>
            the library I'm working on do not break with my
            modifications, but I <br>
            wouldn't like to compile the whole project every time since
            not all <br>
            targets depends on my lib.<br>
          </blockquote>
          <div><br>
          </div>
          <div>Correct me if I'm wrong but if you build the whole
            project once, then modify the lib,</div>
          <div>the next "whole build"  should only rebuild the necessary
            part ? i.e. it'll rebuild</div>
          <div>the lib and all targets that depends on it.<br>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    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.<br></div></blockquote><div><br></div><div>Yes I see this is to be expected.</div><div>Avoiding this kind of rebuild may be tricky because any addition/modification of a CMakeLists.txt will trigger a CMake rerun anyway.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>
    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. :-)<br></div></blockquote><div><br></div><div>Yes you are.</div><div><br></div><div>I think that to achieve what you want you need to craft yourself some tooling using cmake file api.</div><div>Your tool would be able to instrospect the dependent targets using <a href="https://cmake.org/cmake/help/git-stage/manual/cmake-file-api.7.html#codemodel-version-2-target-object">https://cmake.org/cmake/help/git-stage/manual/cmake-file-api.7.html#codemodel-version-2-target-object</a></div><div>and trigger the build of the list of dependent target. </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>
    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.<br></div></blockquote><div><br></div><div>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?</div><div>AIFAIK each time you rebase, you may face whole rebuild, this is not really a CMake issue.</div><div><br></div><div>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?</div><div>see: <a href="https://crascit.com/2016/04/09/using-ccache-with-cmake/">https://crascit.com/2016/04/09/using-ccache-with-cmake/</a> for using ccache with CMake.</div><div>sse: <a href="https://ccache.dev/manual/latest.html#_sharing_a_cache">https://ccache.dev/manual/latest.html#_sharing_a_cache</a> on how to share a ccache directory.</div><div><br></div></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Eric<br></div></div></div></div></div></div>