[CMake] Small, complete CPack example?

Chris Wolf cw10025 at gmail.com
Fri Aug 6 12:57:34 EDT 2010



On 8/6/10 7:22 AM, Eric Noulard wrote:
> 2010/8/6 Chris Wolf <cw10025 at gmail.com>:
>>
>> e.g for :  install(TARGETS usb LIBRARY DESTINATION lib)
>>
>> (where project name is "libusb")
>>
>> The CPack-generated TGZ archive will contain:
>> libusb-0.1.1-Darwin/lib/libusb.dylib
>>
>> ...this, regardless of the setting of CPACK_INCLUDE_TOPLEVEL_DIRECTORY!
>>
>> (I would have expected set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
>>  to result in the archive to contain: ./lib/libusb.dylib)
> 
> This is the case on my box (Linux Debian Squeeze x86_64),
> I can strip off the prefix if I do:
> 
> cpack -D CPACK_INCLUDE_TOPLEVEL_DIRECTORY=0 -G TGZ
> or
> if I set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)

Ok, invoking cpack directly and overriding on the command line
works, but overriding in the list file does not work.
> 
> Which version of CMake are you using on which platform?
> May be it's a bug.

I downloaded it just two days ago: 2.8.2 on MacOS 10.5 (64 bit OS),
the file name is "cmake-2.8.2-Darwin-universal.dmg"
 
> 
>> Another observation regarding the CPack-generated *.pkg
>> (wrapped in a *.dmg) :
>>
>> The path is prefixed by "./usr", somehow:
>>
>> (assuming the *.dmg is already mounted)
>> $ cd ./libusb-0.1.1-Darwin.pkg/Contents
>> $ lsbom -s Archive.bom
>> .
>> ./usr
>> ./usr/lib
>> ./usr/lib/libusb.dylib
>>
>> So where does the "./usr/" prefix come from?
> 
> I'm do not know the dmg CPack Generator
> (is it PackageMaker or DragNDrop?)
>  and I'm not a mac user but each CPack generator has a default
> "builtin" CPACK_PACKAGING_INSTALL_PREFIX.
> 
> Try
> set(CPACK_PACKAGING_INSTALL_PREFIX. "/whatever")
> 

Overriding the setting of CPACK_PACKAGING_INSTALL_PREFIX either in the list
file, or on the command line, has no effect.  Also if I try to look at
it's default value via the "message" command, it's blank.

Note that the issue of "./usr/" being prepended only happens with PackageMaker.
I have not tried DragNDrop, because that's no good for libraries.

Thanks,

Chris Wolf


More information about the CMake mailing list