Rethinking Debian Packaging for VTK (and Other CMake Projects) Part 1

July 3, 2018


At Kitware, we have always done our best to passively help Linux distribution maintainers by accepting pull requests from downstream and adjusting the CMake build system to support the needs of distributions. But now, we’ve decided to take it one step further and actively take part in the downstream packaging process. Specifically, we have embarked on a project to officially support the Visualization Toolkit (VTK) on Debian and its derivatives and to provide all of the Debian packaging scripts to expedite the process of shipping new VTK releases with Debian.

To support this effort, we have created a Debian package with a brand new set of Debhelper scripts. We have named this project “dh-cmake.” It allows Debhelper to take advantage of some of the more advanced capabilities of CMake, such as these:

  • install CMake components into separate binary packages, for example, install the “Development” component into libexample-dev and the “Libraries” component into libexample
    This allows downstream packages to take advantage of the COMPONENT parameter passed to CMake’s install() command.
  • integrate with CTest and CDash so that the output of dh_auto_configure, dh_auto_build and dh_auto_test are submitted to a CDash server in order to monitor the health of a Debian package
    This functionality is especially important for us because it unifies our software development process with the Debian packaging process.
  • integrate with CPack components and component groups
    This is similar to the CMake component installation, but it also propagates CPack’s internal dependency graph into the output packages. For instance, libexample-dev will automatically depend on libexample, if the upstream project is CPack-aware and has this dependency information in its CMakeLists.txt file.

After several months of development and testing, we have a prototype of dh-cmake, which provides all of the above features and successfully builds VTK.

What’s Next?

We want to eventually get dh-cmake into Debian proper. In the meantime, it is available for immediate download from our own servers. You can download the source code or you can install the binaries from our APT repository. To add the repository to your Debian Sid instance, follow the instructions at Then, install dh-cmake:

sudo apt-get install dh-cmake

We will be publishing nightly builds of VTK in the “vtk-master” package soon. You can download the source code for our VTK Debian packaging at

While this is a major milestone for supporting VTK on Debian, there is still a lot of work to do. The next steps will be to polish off dh-cmake by adding documentation and friendlier error messages and continuing to refine the VTK package to bring it closer to what we want it to look like at release time. We will also be publishing Debian packages for Intel’s OSPRay and Embree projects later this year, and we hope that other CMake-based Debian packages will follow our example and use dh-cmake for their own packaging.

Stay tuned for part two of this blog series, where we explain more of the technical details of dh-cmake and the challenges that we faced in its development. Until then, happy hacking!

3 comments to Rethinking Debian Packaging for VTK (and Other CMake Projects) Part 1

    1. Not specifically, but it’s the usual process for creating an executable in CMake: add_executable() and install() the executable in the desired component. dh-cmake will then install it into the proper package based on your configuration.

      Hope this helps!

Leave a Reply