# How to make changes to scripts and patch files used in PATCH\_COMMAND rebuild ExternalProject?

**URL:** <https://discourse.cmake.org/t/how-to-make-changes-to-scripts-and-patch-files-used-in-patch-command-rebuild-externalproject/8666>\
**Category:** Code\
**Created:** [August 2, 2023, 5:06pm UTC](https://discourse.cmake.org/t/how-to-make-changes-to-scripts-and-patch-files-used-in-patch-command-rebuild-externalproject/8666 "2023-08-02T17:06:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![balshetzer](https://discourse.cmake.org/user_avatar/discourse.cmake.org/balshetzer/32/3667_2.png) [@balshetzer](https://discourse.cmake.org/u/balshetzer)\
**Post date:** [August 2, 2023, 5:06pm UTC](https://discourse.cmake.org/t/how-to-make-changes-to-scripts-and-patch-files-used-in-patch-command-rebuild-externalproject/8666/1 "2023-08-02T17:06:31Z")

</div>

I have an `ExternalProject_Add` with a `PATCH_COMMAND bash patch_script.sh` that applies various patch files. How can I get the project to be updated when I modify the script or patch files?

---

<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:** [August 3, 2023, 1:58am UTC](https://discourse.cmake.org/t/how-to-make-changes-to-scripts-and-patch-files-used-in-patch-command-rebuild-externalproject/8666/2 "2023-08-03T01:58:31Z")

</div>

`ExternalProject_add_step(DEPENDS)` is what you want. There’s no access to this from the “builtin” steps though. We did notice this [in one of our projects recently](https://gitlab.kitware.com/paraview/common-superbuild/-/issues/66), so it’s on my radar now at least. Note that the superbuild ships its own `ExternalProject` copy, so it’s a good place for prototyping

---

<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:** [August 3, 2023, 2:01am UTC](https://discourse.cmake.org/t/how-to-make-changes-to-scripts-and-patch-files-used-in-patch-command-rebuild-externalproject/8666/3 "2023-08-03T02:01:12Z")

</div>

FYI @craig.scott

Near-simultaneous bug discovery is always fun 🙂 .

---

<div class="post-metadata">

**Author:** ![balshetzer](https://discourse.cmake.org/user_avatar/discourse.cmake.org/balshetzer/32/3667_2.png) [@balshetzer](https://discourse.cmake.org/u/balshetzer)\
**Post date:** [August 3, 2023, 1:45pm UTC](https://discourse.cmake.org/t/how-to-make-changes-to-scripts-and-patch-files-used-in-patch-command-rebuild-externalproject/8666/4 "2023-08-03T13:45:36Z")

</div>

Thanks for the explanation and for looking into a fix!

---

<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:** [August 3, 2023, 2:12pm UTC](https://discourse.cmake.org/t/how-to-make-changes-to-scripts-and-patch-files-used-in-patch-command-rebuild-externalproject/8666/5 "2023-08-03T14:12:00Z")

</div>

And it was actually pretty easy: [https://gitlab.kitware.com/paraview/common-superbuild/-/merge\_requests/574](https://gitlab.kitware.com/paraview/common-superbuild/-/merge_requests/574)

Once I have it tested in our consumers of the common-superbuild, I’ll look at submitting it to CMake itself (for 3.28).
