# CPack Archive Generator TOPLEVEL\_DIRECTORY Name

**URL:** https://discourse.cmake.org/t/cpack-archive-generator-toplevel-directory-name/4533
**Category:** Usage
**Created:** [November 23, 2021, 4:15pm UTC](https://discourse.cmake.org/t/cpack-archive-generator-toplevel-directory-name/4533 "2021-11-23T16:15:45Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jjELT](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/j/dfb087/32.png) [@jjELT](https://discourse.cmake.org/u/jjELT)
#### Post date: [November 23, 2021, 4:15pm UTC](https://discourse.cmake.org/t/cpack-archive-generator-toplevel-directory-name/4533/1 "2021-11-23T16:15:45Z")

</div>

When creating e.g. a `ZIP` file for all installed binaries using the _CPack Archive Generator_, there appears to be no way to define the name of the toplevel directory within the created archive.

One can only enable/disable the creation of the folder via the [CPACK\_INCLUDE\_TOPLEVEL\_DIRECTORY](https://cmake.org/cmake/help/latest/variable/CPACK_INCLUDE_TOPLEVEL_DIRECTORY.html) variable.

`CPACK_PACKAGE_FILE_NAME` sets both the archive name **and** the toplevel directory name.

The variables `CPACK_ARCHIVE_FILE_NAME` and `CPACK_TOPLEVEL_TAG` appear to have no effect.

Is there a way to set the toplevel directory name?

What I intend to do is create several configuration specific archive names, without the one overriding the other when put into the same directory. When extracting, the contents of all archives should be merged into a single folder with the name of the toplevel directory.

Consider the following archive/folder structure:

```auto
my-project-1.0.0-win64-debug.zip
 -> my-project-1.0.0-win64
 --> bin
 ---> debug
 ----> my-application.exe

my-project-1.0.0-win64-release.zip
 -> my-project-1.0.0-win64
 --> bin
 ---> release
 ----> my-application.exe

C:\Program Files\my-project-1.0.0-win64
 -> bin
 --> debug
 ---> my-application.exe
 --> release
 ---> my-application.exe

```

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [November 24, 2021, 2:30am UTC](https://discourse.cmake.org/t/cpack-archive-generator-toplevel-directory-name/4533/2 "2021-11-24T02:30:30Z")

</div>

This sounds like it probably needs a feature request to me (but it makes sense as well). Please file [an issue](https://gitlab.kitware.com/cmake/cmake/-/issues) to track it.

---

<div class="post-metadata">

### Author: ![jjELT](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/j/dfb087/32.png) [@jjELT](https://discourse.cmake.org/u/jjELT)
#### Post date: [November 24, 2021, 7:34am UTC](https://discourse.cmake.org/t/cpack-archive-generator-toplevel-directory-name/4533/3 "2021-11-24T07:34:12Z")

</div>

I created an issue: [22946](https://gitlab.kitware.com/cmake/cmake/-/issues/22946).
