Skip to content

FetchContent: Force cmake --fresh to re-execute direct population steps

Craig Scott requested to merge craig.scott/cmake:fc-cmp0168-fresh into master

With policy CMP0168 set to NEW, we have full and private control of the stamp, tmp, and download directories. This means we can actually move the stamp and tmp files under the top level CMakeFiles directory, and they will automatically be removed by a cmake --fresh. We still keep the download directory under its existing FETCHCONTENT_BASE_DIR location so that downloaded files can survive across a cmake --fresh and be re-used on the next download step if suitable.

This is related to #25468, but takes advantage of CMP0168 to solve the same problem without needing to define and expose a new global property. Since CMP0168 is new in the current release, this is the time to bring in this change as part of what CMP0168 does.

While working on this, I found a few minor errors, mostly in the test suite. These are closely related, so they have been fixed in separate preceding commits within the MR.

Backport: release

Merge request reports