# CPack: how to omit archive name from archived files' paths

**URL:** https://discourse.cmake.org/t/cpack-how-to-omit-archive-name-from-archived-files-paths/1520
**Category:** Code
**Created:** [July 8, 2020, 5:19pm UTC](https://discourse.cmake.org/t/cpack-how-to-omit-archive-name-from-archived-files-paths/1520 "2020-07-08T17:19:23Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jwuttke](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/j/9dc877/32.png) [@jwuttke](https://discourse.cmake.org/u/jwuttke)
#### Post date: [July 8, 2020, 5:19pm UTC](https://discourse.cmake.org/t/cpack-how-to-omit-archive-name-from-archived-files-paths/1520/1 "2020-07-08T17:19:24Z")

</div>

```auto
project(foo VERSION 0.1.1)
install(
    TARGETS ${lib}
    LIBRARY DESTINATION lib
    RUNTIME DESTINATION lib
    ARCHIVE DESTINATION lib)
set(CPACK_GENERATOR "ZIP")
include(CPack)

```

generates foo-0.1.1-Linux,zip, which contains

- foo-0.1.1-Linux/lib/foo.dll
- foo-0.1.1-Linux/lib/foo.lib

How to get rid of “foo-0.1.1-Linux/” in the archived files’ paths?

---

<div class="post-metadata">

### Author: ![erk](https://discourse.cmake.org/user_avatar/discourse.cmake.org/erk/32/114_2.png) [@erk](https://discourse.cmake.org/u/erk)
#### Post date: [July 8, 2020, 9:48pm UTC](https://discourse.cmake.org/t/cpack-how-to-omit-archive-name-from-archived-files-paths/1520/2 "2020-07-08T21:48:00Z")

</div>

You can set `CPACK_INCLUDE_TOPLEVEL_DIRECTORY` to 0  
this is a generic CPack variable used by all generators. Various generator may use different default value  
when not specified though.

see: [https://cmake.org/cmake/help/latest/variable/CPACK\_INCLUDE\_TOPLEVEL\_DIRECTORY.html](https://cmake.org/cmake/help/latest/variable/CPACK_INCLUDE_TOPLEVEL_DIRECTORY.html)
