The latest version of this document lives in the [vcpkg repo](https://github.com/Microsoft/vcpkg/blob/master/docs/maintainers/vcpkg_extract_source_archive.md).
By default, `vcpkg_extract_source_archive` removes this directory and moves all contents into the directory returned in `<out-var>`. If there is no top-level directory, it is an error.
With this flag, the top-level directory will be preserved and it is not an error to not have one.
### SKIP_PATCH_CHECK
Silence and ignore errors when applying patches.
This option should only be passed when operating in an unstable mode like `--head`. If the sources are pinned, failing to apply a patch should be considered a fatal error.
### PATCHES
List of patches to apply to the extracted source.
Patches will be applied in order, after any top-level directories are removed (see [`NO_REMOVE_ONE_LEVEL`](#no_remove_one_level)). Relative paths are interpreted relative to the current port directory.
If a patch should be conditionally applied based on target information, you can construct a list and splat it.
```cmake
set(patches "")
if(VCPKG_TARGET_IS_WINDOWS)
list(APPEND patches only-windows.patch)
endif()
vcpkg_extract_source_archive(src
ARCHIVE "${archive}"
PATCHES
always-applied.patch
${patches}
)
```
### SOURCE_BASE
Pretty name for the extracted directory.
Must not contain path separators (`/` or `\\`).
See [`WORKING_DIRECTORY`](#working_directory) for more details.
### BASE_DIRECTORY
Root subfolder for the extracted directory.
Defaults to `src`. Must be a relative path.
See [`WORKING_DIRECTORY`](#working_directory) for more details.
### WORKING_DIRECTORY
Root folder for the extracted directory.
Defaults to `${CURRENT_BUILDTREES_DIR}/<BASE_DIRECTORY>`. Must be an absolute path.
`vcpkg_extract_source_archive` extracts the archive into `<WORKING_DIRECTORY>/<SOURCE_BASE>-<short-hash>.clean`. If the folder exists, it is deleted before extraction. Without specifying `SOURCE_BASE`, `BASE_DIRECTORY`, or `WORKING_DIRECTORY`, this will default to `${CURRENT_BUILDTREES_DIR}/src/<archive-stem>-<short-hash>.clean`.
The deprecated overload extracts `<archive>` into `${working_directory}/<archive-filename>.extracted` if the target does not exist. This incorrect behavior allows patches and other modifications to leak between different builds, resulting in hard-to-debug errors.
All uses of the deprecated overload should be replaced with the syntax in [Usage](#usage) above by adding an explicit [`ARCHIVE`](#archive) parameter and replacing direct references to the extracted path with uses of the [`<out-var>`](#out-var).
**Replacement**
This command replaces [`vcpkg_extract_source_archive_ex()`](vcpkg_extract_source_archive_ex.md).