[CMake] ExternalProject: avoiding rebuilds

John Drescher drescherjm at gmail.com
Sat Sep 24 05:32:45 EDT 2011


On Sat, Sep 24, 2011 at 4:11 AM, Rolf Eike Beer <eike at sf-mail.de> wrote:
> Am Freitag, 23. September 2011, 16:26:46 schrieb Ben Medina:
>> Hello all,
>>
>> I'm trying to adopt greater usage of ExternalProject in my project.
>> One problem I'd like to resolve is spurious rebuilds of external
>> projects.
>
> [...]
>
>> This works great: building "test" first untars the CLAPACK source and
>> builds it, as expected. However, if I rebuild test (i.e. in Visual
>> Studio, right-click on test and rebuild), then the CLAPACK tarball get
>> extracted *again*, and a full rebuild of CLAPACK happens. I'd expect
>> that, unless the tarball is changed, a rebuild of the external project
>> is a no-op.
>>
>> Is there a way to achieve my desired behavior?
>
> Yes, use the correct option. Rebuild means "rebuild this target and all of
> it's dependencies". There is a different option, something like "rebuild only
> this target". Just use this one.
>

That may be difficult in practice. I mean I typically have 20 to 40
targets in my projects and sometimes I would want them all rebuilt.
However I there is a batch build option in Visual Studio that can be
used for that. In this case you check which targets you want built so
you can click select all and then uncheck the external project.

John


More information about the CMake mailing list