3

How do you produce a .deb file for ubuntu from the CMake source code?

I already installed (hopefully most of) the build dependencies using apt:

sudo apt-get build-dep cmake

checked out the cmake repo using git:

git clone http://www.cmake.org/cmake.git

built cmake using the older cmake I already have:

cd cmake cmake . make

what next? This is surprisingly hard to google for; most people want to know how to package their own stuff ~with cmake. The CMake install instructions just specify a make install but dependency hell is bad enough ~with a package manager in my experience.

Andrew Wagner
  • 22,677
  • 21
  • 86
  • 100
  • If you are going to create Ubuntu PPA then CPack won't work for you because launchpad build server only executes `dpkg-buildpackage` i.e. expects that you have `debian` folder with manifest. See my comment for details https://stackoverflow.com/a/65582856/1049542 – Sergey Ponomarev Jan 05 '21 at 16:34

1 Answers1

5

After building cmake, use cpack for generate deb package:

cpack -G DEB

It should be run from the build tree.

Rekovni
  • 6,319
  • 3
  • 39
  • 62
Tsyvarev
  • 60,011
  • 17
  • 110
  • 153
  • Thanks; that at least generates a .deb, but it won't install: dpkg: error processing archive... trying to overwrite '/usr/share/aclocal/cmake.m4', which is also in package cmake-data 2.8.12.2-0ubuntu3 – Andrew Wagner Aug 17 '15 at 08:18
  • I tried using ccmake to set CPACK_BINARY_DEB to ON and rebuilding, and that produced a .deb file, but it has the same install problem. – Andrew Wagner Aug 17 '15 at 08:35
  • Ubuntu makes two packages out of cmake by default, one with the binaries and one with the rest. You made one package with both. You can do apt remove cmake-data and your cmake install will proceed. – mheyman Sep 23 '19 at 20:32