6

I'm attempting to build a properly named Debian package using Cpack. I have the following in my CMakeLists.txt:

set(CPACK_PACKAGE_NAME "something")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
set(CPACK_PACKAGE_ARCHITECTURE "amd64")
set(CPACK_PACKAGE_VERSION_MAJOR "0")
set(CPACK_PACKAGE_VERSION_MINOR "9")
set(CPACK_PACKAGE_VERSION_PATCH "0")
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")

but I get file named:

 something-0.9.0-Linux.deb

Instead of:

something-0.9.0_amd64.deb

I've looked at the various documentation pages but haven't found the answer.

Craig S. Anderson
  • 6,966
  • 4
  • 33
  • 46

2 Answers2

6

Cpack does not have CPACK_DEBIAN_PACKAGE_FILE_NAME, may be this should be reported as bug, not all GNU/Linux-BSD systems have same package naming convention.

For now, You can set CPACK_PACKAGE_FILE_NAME which is set by default to:

${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}.

Follow the link to read the full documentation page.

CPACK_DEBIAN_PACKAGE_ARCHITECTURE

The Debian package architecture

Mandatory : YES
Default : Output of `dpkg --print-architecture` (or 'i386' if dpkg is not found)

You may set the file name as:

set(CPACK_PACKAGE_FILE_NAME "${CPACK_DEBIAN_PACKAGE_NAME}-${CPACK_DEBIAN_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.")

By the way, no need to override defaults if they are good.

  • CPACK_DEBIAN_PACKAGE_ARCHITECTURE defaults to dpkg --print-architecture
  • CPACK_DEBIAN_PACKAGE_VERSION defaults to CPACK_PACKAGE_VERSION which by itself is built from major.minor.patch.
user.dz
  • 962
  • 2
  • 19
  • 39
6

Update for cmake >=3.6: Use

set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)

Please note that explicitly setting the default is necessary here. Quoting the docs:

Preferred setting of this variable is DEB-DEFAULT but for backward compatibility with CPackDeb in CMake prior to version 3.6 this feature is disabled by default.

spawn
  • 192
  • 3
  • 9