Skip to content

Conversation

@zhangrongchuan
Copy link

Add installation and packaging targets

This PR adds CMake install rules and CPack configuration to generate .tar.gz
and .deb packages for the cpackexample project.

Build & Package

Inside the Docker container:

mkdir build && cd build
cmake ..
make -j
make package

This produces:

  • cpackexample-0.1.0-Linux.tar.gz
  • cpackexample_0.1.0_amd64.deb

Both archives contain the installed executable, library, and header files.

Debian Package Test

apt install ./cpackexample_0.1.0_amd64.deb
cpackexample

The installed executable runs correctly.

Lintian

lintian was executed as required:

lintian ./cpackexample_0.1.0_amd64.deb > lintian_output.txt

The report is included in the repository.

Copy link
Member

@uekerman uekerman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slight problems, otherwise good.

Comment on lines +6 to +9
set(CPACK_PACKAGE_VERSION_MAJOR "0")
set(CPACK_PACKAGE_VERSION_MINOR "1")
set(CPACK_PACKAGE_VERSION_PATCH "0")
set(CPACK_PACKAGE_VERSION "0.1.0")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to specify both, and better use those from the project description.


set(CPACK_GENERATOR "TGZ;DEB")

set(CPACK_PACKAGING_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let CPack handle this, don't specify manually. You don't want to install in usr/local.

Comment on lines +6 to +11
E: cpackexample: file-in-usr-local [usr/local/bin/cpackexample]
E: cpackexample: file-in-usr-local [usr/local/include/cpackexamplelib/fem.hpp]
E: cpackexample: file-in-usr-local [usr/local/include/cpackexamplelib/filesystem.hpp]
E: cpackexample: file-in-usr-local [usr/local/include/cpackexamplelib/flatset.hpp]
E: cpackexample: file-in-usr-local [usr/local/include/cpackexamplelib/yamlParser.hpp]
E: cpackexample: file-in-usr-local [usr/local/lib/libcpackexamplelib.a]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't ignore such errors.

@uekerman uekerman closed this Jan 4, 2026
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.

2 participants