# Suggestion: Enable FetchContent to Support Extracting Files with '.zst' Extension

**URL:** https://discourse.cmake.org/t/suggestion-enable-fetchcontent-to-support-extracting-files-with-zst-extension/14347
**Category:** Development
**Created:** [July 12, 2025, 4:06am UTC](https://discourse.cmake.org/t/suggestion-enable-fetchcontent-to-support-extracting-files-with-zst-extension/14347 "2025-07-12T04:06:54Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![TheUser](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/t/45deac/32.png) [@TheUser](https://discourse.cmake.org/u/TheUser)
#### Post date: [July 12, 2025, 4:06am UTC](https://discourse.cmake.org/t/suggestion-enable-fetchcontent-to-support-extracting-files-with-zst-extension/14347/1 "2025-07-12T04:06:55Z")

</div>

Used CMake version: 4.0.3

I am trying to use `FetchContent` to fetch [MINGW64-ICU](https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-icu-77.1-2-any.pkg.tar.zst) on Windows. Here is my CMake configuration code:

```cmake
cmake_minimum_required(VERSION 3.20)

FetchContent_Declare(
    ICU
    # Download from MSYS2
    URL "${CMAKE_SOURCE_DIR}/local_repo/mingw-w64-x86_64-icu-77.1-2-any.pkg.tar.zst"
)
FetchContent_Populate(ICU)
FetchContent_GetProperties(ICU SOURCE_DIR ICU_MINGW64_ROOT)
set(ICU_ROOT ${ICU_MINGW64_ROOT}/mingw64)
find_package(ICU REQUIRED COMPONENTS uc)

add_executable(main main.cpp)
target_link_libraries(main PRIVATE ICU::uc)

```

It resulted in an error:  
Do not know how to extract ‘local\_repo/mingw-w64-x86\_64-icu-77.1-2-any.pkg.tar.zst’  
Known types are: .7z, .tar, .tar.bz2, .tar.gz, .tar.xz, .tbz2, .tgz

I tried changing the file extension to ‘.zip’, **and it worked**.

I also attempted modifying `${CMAKE_INSTALL_DIR}\share\cmake-4.0\Modules\ExternalProject\shared_internal_commands.cmake` as follows, **and it also worked** :

```cmake
function(_ep_write_extractfile_script
  script_filename
  name
  filename
  directory
  options
)
  set(args "")

  if(filename MATCHES
# "(\\.|=)(7z|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip)$") # DELETED
    "(\\.|=)(7z|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zst|zip)$") # NEW LINE
    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()

  configure_file(
    "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/extractfile.cmake.in"
    "${script_filename}"
    @ONLY
  )
endfunction()

```

Therefore, I suggest that CMake should officially add support for the ‘.zst’ extension.

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [July 12, 2025, 6:43am UTC](https://discourse.cmake.org/t/suggestion-enable-fetchcontent-to-support-extracting-files-with-zst-extension/14347/2 "2025-07-12T06:43:22Z")

</div>

Please try the CMake 4.1.0 release candidate. A change has already been made to ExternalProject (which FetchContent uses for its implementation) so that it looks at the file’s content rather than the file extension to work out the format. Any format that `cmake -E tar` supports can now be used with ExternalProject and FetchContent. The change was made in [MR 10715](https://gitlab.kitware.com/cmake/cmake/-/merge_requests/10715).
