ExternalProject: Remove explicit list of supported archive types

- Do not try to guess the flags to pass to "cmake -E tar" ("z" or not) based
  on the extension. It is not necessary, as the archive type is autodetected
  since we switched to libarchive.
- Add new tests for .tar.zst archives, which would fail without the change.

Fixes: #25062
This commit is contained in:
Javier Martín
2025-04-25 11:48:02 +02:00
committed by Brad King
parent fb3757654e
commit 1cc85064ff
6 changed files with 13 additions and 18 deletions

View File

@@ -0,0 +1,6 @@
externalproject-archive-types
-----------------------------
* The :module:`ExternalProject` module no longer checks the ``URL`` archive
file extension. Any archive type that :option:`cmake -E tar <cmake-E tar>`
can extract is now allowed.

View File

@@ -301,6 +301,10 @@ URL
.. versionadded:: 3.1
Added support for `tbz2`, `.tar.xz`, `.txz`, and `.7z` extensions.
.. versionadded:: 4.1
All archive types that :option:`cmake -E tar <cmake-E tar>` can extract
are supported regardless of file extension.
Git
~~~

View File

@@ -701,23 +701,8 @@ function(_ep_write_extractfile_script
directory
options
)
set(args "")
if(filename MATCHES
"(\\.|=)(7z|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip)$")
set(args xfz)
endif()
if(filename MATCHES "(\\.|=)tar$")
set(args xf)
endif()
if(args STREQUAL "")
message(FATAL_ERROR
"Do not know how to extract '${filename}' -- known types are: "
".7z, .tar, .tar.bz2, .tar.gz, .tar.xz, .tbz2, .tgz, .txz and .zip"
)
endif()
# cmake -E tar auto detects the type of archive being extracted
set(args "xf")
configure_file(
"${CMAKE_CURRENT_FUNCTION_LIST_DIR}/extractfile.cmake.in"

View File

@@ -142,7 +142,7 @@ set_property(TARGET ${proj} PROPERTY FOLDER "Local/TGZ")
# this more complete, we should add a diff between this and the TGZ tree since
# that one does build.
#
set(extra_cmp_exts tar.bz2 tar.xz zip)
set(extra_cmp_exts tar.bz2 tar.xz tar.zst zip)
foreach(ext IN LISTS extra_cmp_exts)
string(TOUPPER "${ext}" name)

Binary file not shown.

Binary file not shown.