# CPack: why NOT reuse the installation tree?

**URL:** https://discourse.cmake.org/t/cpack-why-not-reuse-the-installation-tree/9143
**Category:** Development
**Created:** [October 5, 2023, 11:35am UTC](https://discourse.cmake.org/t/cpack-why-not-reuse-the-installation-tree/9143 "2023-10-05T11:35:19Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [October 5, 2023, 11:35am UTC](https://discourse.cmake.org/t/cpack-why-not-reuse-the-installation-tree/9143/1 "2023-10-05T11:35:20Z")

</div>

I am woundering why `CPack` waste the disk space in this way?

```bash
klein_cl:~/Workspace/cpp/axcioma/build$ tree -d -L 4 _CPack_Packages/
_CPack_Packages/
└── Linux
    ├── STGZ
    │ └── itaox11-2.2.0-Linux
    │ ├── bin
    │ ├── include
    │ ├── lib
    │ └── share
    ├── TGZ
    │ └── itaox11-2.2.0-Linux
    │ ├── bin
    │ ├── include
    │ ├── lib
    │ └── share
    └── TZ
        └── itaox11-2.2.0-Linux
            ├── bin
            ├── include
            ├── lib
            └── share

19 directories
klein_cl:~/Workspace/cpp/axcioma/build$ ls -lrsSa _CPack_Packages/Linux/*
_CPack_Packages/Linux/TZ:
total 29568
    4 drwxrwxr-x 6 klein_cl klein_cl 4096 Oct 5 13:16 itaox11-2.2.0-Linux
    4 drwxrwxr-x 5 klein_cl klein_cl 4096 Oct 5 13:16 ..
    4 drwxrwxr-x 3 klein_cl klein_cl 4096 Oct 5 13:16 .
29556 -rw-rw-r-- 1 klein_cl klein_cl 30262735 Oct 5 13:16 itaox11-2.2.0-Linux.tar.Z

_CPack_Packages/Linux/TGZ:
total 17556
    4 drwxrwxr-x 6 klein_cl klein_cl 4096 Oct 5 13:16 itaox11-2.2.0-Linux
    4 drwxrwxr-x 5 klein_cl klein_cl 4096 Oct 5 13:16 ..
    4 drwxrwxr-x 3 klein_cl klein_cl 4096 Oct 5 13:16 .
17544 -rw-rw-r-- 1 klein_cl klein_cl 17964304 Oct 5 13:16 itaox11-2.2.0-Linux.tar.gz

_CPack_Packages/Linux/STGZ:
total 17548
    4 drwxrwxr-x 6 klein_cl klein_cl 4096 Oct 5 13:16 itaox11-2.2.0-Linux
    4 drwxrwxr-x 5 klein_cl klein_cl 4096 Oct 5 13:16 ..
    4 drwxrwxr-x 3 klein_cl klein_cl 4096 Oct 5 13:16 .
17536 -rwxrwxrwx 1 klein_cl klein_cl 17953826 Oct 5 13:16 itaox11-2.2.0-Linux.sh
klein_cl:~/Workspace/cpp/axcioma/build$ ll
total 65676
drwxrwxr-x 8 klein_cl klein_cl 4096 Oct 5 13:16 ./
drwxrwxr-x 16 klein_cl klein_cl 4096 Oct 5 12:45 ../
-rw-rw-r-- 1 klein_cl klein_cl 87128 Oct 5 12:45 .ninja_deps
-rw-rw-r-- 1 klein_cl klein_cl 4674 Oct 5 12:45 .ninja_log
-rw-rw-r-- 1 klein_cl klein_cl 28750 Oct 5 12:45 CMakeCache.txt
drwxrwxr-x 6 klein_cl klein_cl 4096 Oct 5 12:45 CMakeFiles/
drwxrwxr-x 2 klein_cl klein_cl 4096 Oct 5 12:45 CPM_modules/
-rw-rw-r-- 1 klein_cl klein_cl 4055 Oct 5 12:45 CPackConfig.cmake
-rw-rw-r-- 1 klein_cl klein_cl 4508 Oct 5 12:45 CPackSourceConfig.cmake
-rw-rw-r-- 1 klein_cl klein_cl 374 Oct 5 12:45 CTestTestfile.cmake
drwxrwxr-x 3 klein_cl klein_cl 4096 Oct 5 12:45 _CPack_Packages/
drwxrwxr-x 5 klein_cl klein_cl 4096 Oct 5 12:45 _deps/
drwxrwxr-x 2 klein_cl klein_cl 4096 Oct 5 12:45 bin/
-rw-rw-r-- 1 klein_cl klein_cl 70647 Oct 5 12:45 build.ninja
-rw-rw-r-- 1 klein_cl klein_cl 7058 Oct 5 12:45 cmake_install.cmake
-rw-rw-r-- 1 klein_cl klein_cl 15854 Oct 5 12:45 compile_commands.json
-rw-rw-r-- 1 klein_cl klein_cl 499 Oct 5 12:45 cpm-package-lock.cmake
-rw-rw-r-- 1 klein_cl klein_cl 772234 Oct 5 13:16 install_manifest.txt
-rwxrwxrwx 1 klein_cl klein_cl 17953826 Oct 5 13:16 itaox11-2.2.0-Linux.sh*
-rw-rw-r-- 1 klein_cl klein_cl 30262735 Oct 5 13:16 itaox11-2.2.0-Linux.tar.Z
-rw-rw-r-- 1 klein_cl klein_cl 17964304 Oct 5 13:16 itaox11-2.2.0-Linux.tar.gz
-rw-rw-r-- 1 klein_cl klein_cl 283 Oct 5 12:45 itaox11Config.cmake
-rw-rw-r-- 1 klein_cl klein_cl 2762 Oct 5 12:45 itaox11ConfigVersion.cmake
drwxrwxr-x 2 klein_cl klein_cl 4096 Oct 5 12:45 lib/
klein_cl:~/Workspace/cpp/axcioma/build$

```

---

<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: [October 5, 2023, 12:30pm UTC](https://discourse.cmake.org/t/cpack-why-not-reuse-the-installation-tree/9143/2 "2023-10-05T12:30:51Z")

</div>

CPack has no way of knowing that package format A is the same as package format B. For example, that directory should look far different for a macOS `.pkg` versus a `.tar.X` on macOS.

---

<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: [October 5, 2023, 8:33pm UTC](https://discourse.cmake.org/t/cpack-why-not-reuse-the-installation-tree/9143/3 "2023-10-05T20:33:34Z")

</div>

Technically I think it is also possible to have different contents for different package generators.
