# Best way to preserve downloaded files with \`ExternalProject\_Add()\`

**URL:** https://discourse.cmake.org/t/best-way-to-preserve-downloaded-files-with-externalproject-add/12995
**Category:** Code
**Created:** [November 20, 2024, 7:24am UTC](https://discourse.cmake.org/t/best-way-to-preserve-downloaded-files-with-externalproject-add/12995 "2024-11-20T07:24:39Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![yashi](https://discourse.cmake.org/user_avatar/discourse.cmake.org/yashi/32/557_2.png) [@yashi](https://discourse.cmake.org/u/yashi)
#### Post date: [November 20, 2024, 7:24am UTC](https://discourse.cmake.org/t/best-way-to-preserve-downloaded-files-with-externalproject-add/12995/1 "2024-11-20T07:24:39Z")

</div>

I’m using multiple `ExternalProject_Add()` calls with `URL` to manage my dependencies. While it works fine, the specified files are downloaded into my build directory.

When I want to perform a clean build, I usually remove my `builddir` and start over. However, downloading many dependency files takes time, and I’d like to preserve these files somehow. What is the best way to achieve this?

The `EP_BASE` option, as mentioned in the [documentation](https://cmake.org/cmake/help/latest/module/ExternalProject.html#id3), specifies a base directory for all external project-related directories, including downloads and build directories. However, I only want to preserve the downloaded files.

I understand that someone might argue, “If you’re using old files, it’s not a clean build.” That could be true, but I believe that already downloaded files can be verified using their hashes.
