[CMake] CPack general question and example

Vladislav Vaintroub vvaintroub at googlemail.com
Mon Nov 15 17:08:45 EST 2010


> -----Original Message-----
> From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf Of David Doria
> Sent: Monday, November 15, 2010 10:37 PM
> To: cmake at cmake.org
> Subject: [CMake] CPack general question and example
> 
> I just heard about CPack and started playing with it. I tried to make
> an RPM of a simple VTK program:
> 
> http://www.cmake.org/Wiki/CMake/CPackExample
> 
> When I run 'make package', I get an error:
> 
> CPack Error: Problem copying the package:
> /home/doriad/CPackTest/bin/_CPack_Packages/Linux/RPM/DistanceBetweenPoints-0.1.1-Linux.rpm
> to /home/doriad/CPackTest/bin/DistanceBetweenPoints-0.1.1-Linux.rpm
> CPack Error: Error when generating package: DistanceBetweenPoints
> make: *** [package] Error 1
> 
> If I leave out the
> SET(CPACK_GENERATOR "RPM")
> line, there are no errors, but the .tar.gz file that is created seems
> to be empty. Am I missing something?
> 
> On a bigger question - what can I expect to be contained in the RPM?
> EVERYTHING required to run my program (which will include all of VTK
> (or at least the required bits?))? I'm just trying to get a handle on
> when and why I would want to do this.

You need  INSTALL commands for everything you want to be in the package

For your example:

ADD_EXECUTABLE(DistanceBetweenPoints DistanceBetweenPoints.cxx)
INSTALL(TARGETS DistanceBetweenPoints DESTINATION bin) # Add this for CPack to work

Then both "make install" and "make package" will work , and there will be bin directory in the package  with DistanceBetweenPoints
executable in it.

Vladislav




More information about the CMake mailing list