[CMake] Small, complete CPack example?
Chris Wolf
cw10025 at gmail.com
Thu Aug 5 19:56:15 EDT 2010
On 8/5/10 6:22 PM, Eric Noulard wrote:
> 2010/8/6 Chris Wolf <cw10025 at gmail.com>:
>>
>> Unfortunately, at first, I din't see how your example is different from
>> the parts of my CMakeList.txt I sent in my last post.
>>
>> Then I noticed that your "install(TARGETS..." command had a relative
>> path for "DESTINATION", whereas mine had an absolute path. When
>> I changed to a relative path, it worked...
>
> You should really avoid using absolute path destination for installation.
>
> If you cannot avoid it then you should tell CPack to use DESTDIR
> set(CPACK_SET_DESTDIR ON)
>
> however this comes with some trouble too,
> see:http://public.kitware.com/Bug/view.php?id=7000
>
>
Yes, but since this is my first day with CMake, I thought I was
keeping things simple by using an absolute path, to avoid uncertainty
as to where things were being installed. Naturally, and as you
suggest, absolute paths are inflexible for a finished product.
Some other observations:
The CPack-generated tar archive saves the artifact (a shared library,
in my case) prefixed by the relative directory specified in
install(TARGETS...), which, in turn, is again prefixed by a directory
named by the projectname + "-0.1.1" + platformname.
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)
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?
Thanks,
Chris Wolf
More information about the CMake
mailing list