# Why does externalproject downloads and compiles every time ?

**URL:** https://discourse.cmake.org/t/why-does-externalproject-downloads-and-compiles-every-time/9070
**Category:** Code
**Tags:** os:linux
**Created:** [September 24, 2023, 6:16pm UTC](https://discourse.cmake.org/t/why-does-externalproject-downloads-and-compiles-every-time/9070 "2023-09-24T18:16:36Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![bytecounter](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/4491bb/32.png) [@bytecounter](https://discourse.cmake.org/u/bytecounter)
#### Post date: [September 24, 2023, 6:16pm UTC](https://discourse.cmake.org/t/why-does-externalproject-downloads-and-compiles-every-time/9070/1 "2023-09-24T18:16:36Z")

</div>

Hello,  
i’m using externalproject alot but he downloads and builds the targets everytime i build it. why is this happening?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [September 24, 2023, 6:53pm UTC](https://discourse.cmake.org/t/why-does-externalproject-downloads-and-compiles-every-time/9070/2 "2023-09-24T18:53:45Z")

</div>

If you’re using a `Ninja` generator, I suggest using `ninja -d explain` to see why it thinks it needs to re-download all the time.

---

<div class="post-metadata">

### Author: ![bytecounter](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/4491bb/32.png) [@bytecounter](https://discourse.cmake.org/u/bytecounter)
#### Post date: [September 24, 2023, 6:58pm UTC](https://discourse.cmake.org/t/why-does-externalproject-downloads-and-compiles-every-time/9070/3 "2023-09-24T18:58:20Z")

</div>

no, i’m using linux and makefiles

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [September 24, 2023, 7:09pm UTC](https://discourse.cmake.org/t/why-does-externalproject-downloads-and-compiles-every-time/9070/4 "2023-09-24T19:09:58Z")

</div>

The equivalent there is `make -d`, but it is very verbose.

---

<div class="post-metadata">

### Author: ![bytecounter](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/4491bb/32.png) [@bytecounter](https://discourse.cmake.org/u/bytecounter)
#### Post date: [September 24, 2023, 7:27pm UTC](https://discourse.cmake.org/t/why-does-externalproject-downloads-and-compiles-every-time/9070/5 "2023-09-24T19:27:42Z")

</div>

i use cmake . to config  
cmake --build . to build  
cmake --install to install and  
ctest to run the tests

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [September 24, 2023, 7:33pm UTC](https://discourse.cmake.org/t/why-does-externalproject-downloads-and-compiles-every-time/9070/6 "2023-09-24T19:33:39Z")

</div>

Instead of `cmake --build .`, use `make` directly to get more information about why it is rerunning that command all the time.

---

<div class="post-metadata">

### Author: ![scivision](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/a87d85/32.png) [@scivision](https://discourse.cmake.org/u/scivision)
#### Post date: [September 24, 2023, 9:03pm UTC](https://discourse.cmake.org/t/why-does-externalproject-downloads-and-compiles-every-time/9070/7 "2023-09-24T21:03:29Z")

</div>

If you’re using the URL method and don’t specify a hash, I believe the default behavior is that it’s redownloaded every time. I typically use the external project option

```cmake
UPDATE_DISCONNECTED true

```

Or for all ExternalProject in that directory scope

```cmake
set_property(DIRECTORY PROPERTY EP_UPDATE_DISCONNECTED true)

```

That should stop the constant redownloading on every configure.

I also like external project option

```auto
CONFIGURE_HANDLED_BY_BUILD true

```

That in general will save significant time of reconfiguring external projects besides just the redownloading.
