Skip to content

Conversation

@prasithbasky
Copy link

@prasithbasky prasithbasky commented Dec 10, 2025

Description

This PR updates the CMake configuration to support installation and packaging via CPack. The following changes have been implemented:

  • Install Targets: Added install commands to CMakeLists.txt for the cpackexample executable, cpackexamplelib library, and associated header files using GNUInstallDirs.
  • CPack Configuration: Created cmake/CPackConfig.cmake to generate .tar.gz and .deb packages.
  • Debian Specifics: Configured CPack to use the standard Debian naming scheme (DEB-DEFAULT) and enabled automatic dependency detection (shlibdeps).
  • Optimization: Enabled CMAKE_INSTALL_DO_STRIP to strip symbols and reduce the final package size.

How to Test

To verify these changes, please follow these steps using the provided Docker environment:

### 1. Build and Run the Docker Container
```bash
docker build -t cpack-image .
docker run --rm -it --mount type=bind,source="$(pwd)",target=/mnt/cpack-exercise cpack-image
  1. Build and Package

Inside the Docker container:

cd /mnt/cpack-exercise
rm -rf build && mkdir build && cd build
cmake ..
make -j4
make package
  1. Verify Installation and Execution

    apt install ./cpackexample_0.1.0-1_amd64.deb
    cpackexample

Lintian Output

lintian ./cpackexample_0.1.0-1_amd64.deb 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant