Advanced CPack Customization
Introduction
CPack is highly customizable, allowing you to tailor your packages to specific needs. In this lesson, we’ll cover:
- Adding metadata (e.g., version, description, vendor).
- Including additional files (e.g., licenses, READMEs).
- Creating platform-specific installers (e.g.,
.pkg
for macOS).
Key Concepts
- CPack Metadata: Customize package information like name, version, and description.
- Including Files: Add extra files (e.g., licenses, READMEs) to your package.
- Platform-Specific Installers: Use generators like
PackageMaker
for macOS.pkg
files.
Code Sample
- Update your
CMakeLists.txt
:
- Create a
LICENSE.txt
file:
MIT License
Copyright (c) 2023 MyCompany
Permission is hereby granted...
- Create a
README.md
file:
- Build and package the product:
If you open the .dmg file it will show you the contents of the LICENSE.txt
file and ask you to agree. The .dmg
and .tar.gz
packages will now include the LICENSE.txt
and README.md
files.