# cpack: how to generate a deb package with dependencies ?

**URL:** https://discourse.cmake.org/t/cpack-how-to-generate-a-deb-package-with-dependencies/10663
**Category:** Usage
**Created:** [April 15, 2024, 3:56pm UTC](https://discourse.cmake.org/t/cpack-how-to-generate-a-deb-package-with-dependencies/10663 "2024-04-15T15:56:11Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![neundorf](https://discourse.cmake.org/user_avatar/discourse.cmake.org/neundorf/32/2075_2.png) [@neundorf](https://discourse.cmake.org/u/neundorf)
#### Post date: [April 15, 2024, 3:56pm UTC](https://discourse.cmake.org/t/cpack-how-to-generate-a-deb-package-with-dependencies/10663/1 "2024-04-15T15:56:11Z")

</div>

Hi,

when generating a rpm file using cpack, the rpm tools automatically scan the files which go into the rpm and generate the dependency info from that.  
Now I tried the same with deb, it tells me that CPACK\_DEBIAN\_PACKAGE\_DEPENDS is empty, so the resulting package will have no dependencies.  
So, do I have to collect the package names manually ? Or is there some way to enable automatic dependencies for deb files ?

Thanks  
Alex

---

<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: [April 15, 2024, 4:32pm UTC](https://discourse.cmake.org/t/cpack-how-to-generate-a-deb-package-with-dependencies/10663/2 "2024-04-15T16:32:08Z")

</div>

Not sure but I think this was not the historical behavior for CPack Deb because the generator was not relying on debian packaging tools.

Could you try to set CPACK\_DEBIAN\_PACKAGE\_SHLIBDEPS to ON.  
see:  
[https://cmake.org/cmake/help/latest/cpack\_gen/deb.html#variable:CPACK\_DEBIAN\_PACKAGE\_SHLIBDEPS](https://cmake.org/cmake/help/latest/cpack_gen/deb.html#variable:CPACK_DEBIAN_PACKAGE_SHLIBDEPS)

You have CPACK\_DEBIAN\_PACKAGE\_DEPENDS too but this one is for “manual deps specs”.

This will only work if `dpkg-shlibdeps` command is available.  
i.e. if you are building on debian based distro.
