Commit Graph

6 Commits

Author SHA1 Message Date
Craig Scott
5fbac2bb24 ExternalProject: Move inline scripts to separate files
This makes the scripts easier to work on, since the separate files
don't require the extra level of escaping that the inlined code did.
This also means the scripts can be rendered with appropriate
syntax highlighting in IDEs, etc.
2022-01-22 23:00:26 +11:00
Craig Scott
036517fe0b ExternalProject: Move existing step scripts to separate subdirectory
This is in preparation for moving more inline content to separate
scripts as well. Having them in a separate subdirectory is consistent
with other modules and will make them easier to find and work with.
2022-01-22 16:24:16 +11:00
Craig Scott
57d442e182 Revert ExternalProject and FetchContent refactoring
Refactoring of the ExternalProject and FetchContent modules moved
the commands into CMake scripts. This broke custom commands that
used shell redirection or special build tool variables of the form
$(MakeVar). Undo the sequence of commits that performed this
refactoring and follow-up fixes associated with it.

The following commits are reverted by this change:

4f3d1abbb4 (ExternalProject: Refactor pre-configure steps to support
no-target uses, 2021-02-05)

17e5516e60 (FetchContent: Invoke steps directly and avoid a separate
sub-build, 2021-01-29)

bd876f3849 (FetchContent: Restore patch command support,
2021-02-18)

404cddb7bb (ExternalProject: Fix misuse of IS_NEWER_THAN in
timestamp checks, 2021-02-21)

b0da671243 (FetchContent: Don't update timestamps if files don't
change, 2021-02-18)

Fixes: #21892
2021-03-10 09:07:44 +11:00
Craig Scott
404cddb7bb ExternalProject: Fix misuse of IS_NEWER_THAN in timestamp checks
When using a file system which only has second resolution timestamps,
there is a reasonably high likelihood of timestamps being the same.
The IS_NEWER_THAN test returns true when timestamps are the same,
so don't redo downloads when they match exactly.
2021-02-22 11:02:20 -05:00
Craig Scott
17e5516e60 FetchContent: Invoke steps directly and avoid a separate sub-build
The cost of setting up and executing a separate sub-build to do the
download, update and patch steps required for FetchContent population
can be significant with some platforms and CMake generators. Avoid the
sub-build altogether by invoking the step scripts directly.

Previously, if no generator was set (e.g. population was being done in
script mode), a generator needed to be available on the default PATH.
Since we no longer use a sub-build, this restriction is also now gone.

Fixes: #21703
2021-02-05 07:33:38 +11:00
Craig Scott
4f3d1abbb4 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
2021-02-05 07:33:38 +11:00