[CMake] CPack: Detecting if to build DEB/RPM packages

Freddie Witherden freddie at witherden.org
Wed Jul 21 18:37:52 EDT 2010


Hi,

I use CPack in my project to build binary packages as an alternative to `make 
install`.  However, I am interested in getting my project to automatically 
detect which packages to build.

Currently I have TGZ set and then require the user to pass the appropriate 
parameter to `cmake` (such as -DCPACK_BINARY_DEB:BOOL=on) to have deb/rpm 
packages made.

I wish to know how I can have CMake/CPack determine if it is possible to build 
an RPM or DEB package on the system (so if all the required utilities are 
installed) and if so to go ahead and package them.

This would simplify things for people who checkout the project as they just 
need to type `make package` and can be sure of the appropriate package being 
built.

However I am unsure how to reliably go about the detection process.  (Asking 
CMake to produce an RPM package on my Debian Squeeze system only fails when 
one tries to make the package -- after `cmake` has run.)

Regards, Freddie.


More information about the CMake mailing list