LLMpediaThe first transparent, open encyclopedia generated by LLMs

CPack

Generated by GPT-5-mini
Note: This article was automatically generated by a large language model (LLM) from purely parametric knowledge (no retrieval). It may contain inaccuracies or hallucinations. This encyclopedia is part of a research project currently under review.
Article Genealogy
Parent: CMake Hop 5
Expansion Funnel Raw 86 → Dedup 0 → NER 0 → Enqueued 0
1. Extracted86
2. After dedup0 (None)
3. After NER0 ()
4. Enqueued0 ()
CPack
NameCPack
DeveloperKitware
Released2000
Programming languageC++
Operating systemWindows, Linux, macOS
LicenseBSD license

CPack is a cross-platform packaging system distributed with CMake that automates creation of installers and archives for software projects. It interacts with multiple packaging backends and integrates with build tooling such as CTest, enabling reproducible delivery artifacts for projects originating from diverse ecosystems like Qt, Boost, and LLVM. Projects maintained by organizations such as KDE, KDE Plasma, Apache projects, and research groups at institutions like NASA often use CMake with CPack for packaging release deliverables.

Overview

CPack provides a layer between a build system and platform-native packagers such as RPM, DEB, NSIS, and pkgbuild that standardizes packaging metadata and workflows. It is distributed as part of the CMake project by Kitware and is commonly invoked through the cmake command-line tool or by higher-level continuous integration systems such as Jenkins, GitHub Actions, and GitLab CI. CPack supports integration with project repositories hosted on platforms like GitHub, GitLab, and Bitbucket and fits into release pipelines employed by corporations such as Red Hat and Canonical for distribution packaging.

Features and Components

CPack exposes generators, component grouping, installation rules, and scripting hooks that can be combined for complex packaging scenarios. Its feature set overlaps with tooling from Autotools, Meson, and Bazel but focuses on interoperability with platform packagers such as MSI, NSIS, DPKG, and archive formats like ZIP. CPack includes modules and variables that reference installation manifests, license files, and package metadata used by ecosystems such as Homebrew, Chocolatey, and SUSE Studio. It supports component-driven installers used in projects like Krita and Blender and works with digital signing systems employed by Apple Developer and Microsoft Corporation.

Supported Package Generators

CPack ships with multiple generators that produce platform-specific outputs. Notable generators include: NSIS for Windows, WIX for Windows Installer XML, DragNDrop for macOS, BundleUtilities for app bundles, RPM for RHEL and Fedora, DEB for Debian and Ubuntu, ZIP for cross-platform archives, TGZ for Unix tarballs, and TBZ2 for FreeBSD and other systems. Additional generators target ecosystems like CPAN and artifacts compatible with Conda distributions. Third-party integrations enable output for container-oriented systems such as Docker when combined with community tooling.

Configuration and Usage

Projects configure CPack through CMakeLists and variables like CPACK_PACKAGE_NAME, CPACK_PACKAGE_VERSION, and CPACK_INSTALL_PREFIX, alongside policy-driven options aligned with CMake documentation. Configurations may reference maintainer metadata used by distributions such as Debian and Fedora and license identifiers recognized by organizations like the Open Source Initiative. Typical usage patterns include adding pack license files, embedding changelogs adopted by projects like Mozilla Firefox and Chromium, and tuning component payloads as seen in KDevelop and Qt Creator releases. CPack can be extended via component scripts and frameworks used by projects such as LibreOffice and GIMP to perform pre-install and post-install actions.

Integration with CMake Projects

CPack is invoked from CMake with commands like include(CPack) and integrates seamlessly with install() directives used by CMake-based projects including LLVM, GTK, and OpenCV. It respects install component definitions applied in projects such as PCL and OGRE and interacts with packaging metadata produced by CPackComponent, allowing per-component packaging similar to repositories maintained by Eclipse Foundation and Apache Software Foundation. Toolchains managed by Conan or vcpkg often coexist with CPack in the same build pipeline for dependency management and final artifact assembly.

Examples and Common Workflows

Common workflows involve configuring CMake with project-specific metadata, running cmake --build, then cpack to produce packages consumed by distribution channels such as Launchpad PPAs, OpenBuildService, or corporate artifact repositories managed with Artifactory or Nexus Repository. Example projects using CPack-like flows include KDE Applications, X.org, Mesa, and FreeCAD. Continuous integration pipelines in Travis CI, CircleCI, and Azure Pipelines frequently invoke cpack to generate release artifacts that are then uploaded to release pages on GitHub Releases or to package registries like PyPI for Python-adjacent deliverables. Advanced users script multi-platform builds combining tools from CMake, CTest, CPack and deployment engines from Ansible, Puppet, and Chef for automated, repeatable packaging.

Category:Software