ExternalProject: Refactor pre-configure steps to support no-target uses

The mkdir, download, update and patch steps are used by
FetchContent during the configure phase of the main build. Because
these steps need a target, this has so far required a sub-build to be
set up. The changes here factor out the preparation of the scripts
from the creation of the targets, allowing future work to leverage these
steps without a sub-build (see #21703).

As part of the refactoring, some rationalisation of the stamp files,
repository info files and script names was done to make things more
consistent between download methods and step implementations.
Every download method now records its own specific repository info
in a file and that file is a dependency of the download step. The source
directory is also written to that file, so if the SOURCE_DIR changes, the
download will be retriggered (the existing implementation fails in this
scenario). Each download method now also has just one driver script
that implements the whole step (it may pull in other scripts to do its
task though). The patch step gained support for USES_TERMINAL as
a result of generalising the implementation for custom commands.

Fixes: #21748
This commit is contained in:
Craig Scott
2021-02-05 07:32:58 +11:00
parent 23aab9ecce
commit 4f3d1abbb4
21 changed files with 1309 additions and 794 deletions

View File

@@ -0,0 +1,7 @@
fetchcontent-performance
------------------------
* The implementation of the :module:`ExternalProject` module was
significantly refactored. The patch step gained support for
using the terminal with a new ``USES_TERMINAL_PATCH`` keyword
as a by-product of that work.