[CMake] Re: CMake, CPack, RPM

Eric Noulard eric.noulard at gmail.com
Thu Oct 11 02:24:24 EDT 2007


2007/10/10, kent williams <nkwmailinglists at gmail.com>:
> OK, so... if I use the built in RPM generator it will generate an RPM.
>  It isn't clear to me what ends up in that RPM aside from the files in
> the manifest -- no dependencies seem to be mentioned.

That's almost true.
RPM generator cannot guess your dependencies and
will package all files which are INSTALL(....) in your CMakeLists.txt files.
You'll get some dependencies because CPack RPM use
rpmbuild command to build the RPM and this command
try it's best to add "guessable" binary dependencies.

> Using UseRPMTools.cmake to try and generate a source RPM doesn't work
> so hot. You can only make a source RPM if there's a package 'cmake' in
> the RPM database apparently. If you haven't installed such an RPM (and
> I'm not sure who installs CMake from an RPM) you're SOL, even if you
> do have CMake installed and available.

The specs file generated by UseRPMTools
include the requirement:

BuildRequires:	cmake

This is "logical" since the Source RPM you will build
 precisely WILL NEED cmake to produce the binary RPM.

Many RPM based distros I know DO provide cmake prebuilt RPM.
I don't yours but you may try: http://rpm.pbone.net/ in order
to see if you can find one.

>
> Which is kind of a cart-before-horse situation.  Obviously you have
> CMake installed, if you're using CMake to build the RPM.  On the other
> hand, you probably should require CMake as a prerequisite.

You get it.
That's why CPack builtin RPM don't put *any* requirement,
using CPack buitlin RPM you should be able to build a binary RPM
(including CMake RPM itself if you compile CMake yourself).


> This particular program requires ITK, VTK, KWWidgets, (header and
> libs) and CMake (executable) at a minimum for a source distribution.
> For a binary distribution you don't need CMake, but you do need all
> the SO Libraries from ITK, VTK, KWWidgets.  Not sure how I'd put that
> into the spec files.

If you use either CPack built-in RPM or UseRPMTools macro
you are able to specify your own .spec file which may include
your requirement.
See http://wiki.rpm.org/Docs for informations about the content
of a spec file.

For example for RPMTools:

RPMTools_ADD_RPM_TARGETS(packagename)

will generate a "minimal" spec file for you
whereas
RPMTools_ADD_RPM_TARGETS(packagename ${CMAKE_SOURCE_DIR}/package.spec)

will use the provided spec file.

Using CPack built-in RPM
SET(RPM_USER_BINARY_SPECFILE <pathto_specfile>)
will provide the user spec file to the generator.
Currently this may not work because:
http://www.cmake.org/pipermail/cmake/2007-September/016606.html

The trouble is that nor CPack nor UseRPMTools may guess
the requirement you probably "manually" set-up using
a bunch of FIND_PACKAGE + TARGET_LIBRARY +...

May be I can think about a way to "only specify" dependencies
and not the "whole spec file".

I don't know if I would have time for working on this, by the end of this week
but I may give it a try next week.

-- 
Erk


More information about the CMake mailing list