diff --git a/Help/release/dev/externalproject-archive-types.rst b/Help/release/dev/externalproject-archive-types.rst new file mode 100644 index 0000000000..a748a38236 --- /dev/null +++ b/Help/release/dev/externalproject-archive-types.rst @@ -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 ` + can extract is now allowed. diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 37bd39cae3..61e2ea5656 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -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 ` can extract + are supported regardless of file extension. + Git ~~~ diff --git a/Modules/ExternalProject/shared_internal_commands.cmake b/Modules/ExternalProject/shared_internal_commands.cmake index ac5d2bddc3..cb7b772225 100644 --- a/Modules/ExternalProject/shared_internal_commands.cmake +++ b/Modules/ExternalProject/shared_internal_commands.cmake @@ -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" diff --git a/Tests/ExternalProjectLocal/CMakeLists.txt b/Tests/ExternalProjectLocal/CMakeLists.txt index c956fe4d01..8f753bcd50 100644 --- a/Tests/ExternalProjectLocal/CMakeLists.txt +++ b/Tests/ExternalProjectLocal/CMakeLists.txt @@ -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) diff --git a/Tests/ExternalProjectLocal/Step1.tar.zst b/Tests/ExternalProjectLocal/Step1.tar.zst new file mode 100644 index 0000000000..3731108d23 Binary files /dev/null and b/Tests/ExternalProjectLocal/Step1.tar.zst differ diff --git a/Tests/ExternalProjectLocal/Step1NoDir.tar.zst b/Tests/ExternalProjectLocal/Step1NoDir.tar.zst new file mode 100644 index 0000000000..f453b750ea Binary files /dev/null and b/Tests/ExternalProjectLocal/Step1NoDir.tar.zst differ