[CMake] Configuring CPack to Build Packages My Way

Eric Noulard eric.noulard at gmail.com
Sat Sep 14 03:46:23 EDT 2013


2013/9/13 Stewart, Robert <Robert.Stewart at sig.com>:
> Bill Hoffman wrote:

[...]

>
> I'll try again.  In my build tree, I arranged for the INSTALL() commands to create and populate some directories, noted by "installed" below:
>
> /my/build/directory/
>    builds/
>    installed/
>    source/
>    CMakeLists.txt
>
> That is, installed will have files and directories within it, and each subdirectory will have files and directories within it.  The contents of installed aren't important, just that I can collect them in the desired arrangement and then put them into a package, created by CPack, so they can be installed where the user chooses.  I'd also like a default location for installers (not for zip files or tarballs, of course).

That's pretty clear, however giving a minimal set of example files
including CMakeLists.txt
would ease understanding.

I have several question:

Q1) Do all your install(... DESTINATION relpath/to/install) have
relative path destination or not?
Q2) What is the exact set of CPack generator you need?
      all the archive generators (ZIP, TGZ, TBZ2, etc...) may be
handled the same way
     but "installers" (DEB, RPM,NSIS, ...) do have specific config var.
Q3) Do you use COMPONENT packaging or not?

>
> Suppose a user is using a tarball from CPack:
>
>> cd foo
>> ls foo
>> tar zxf my_package.tar.gz
>> ls
> installed
>
> If the user runs cd installed, everything that CMake would have put into /my/build/directory/installed would appear.
>
> I don't want any other directories to be created when extracting the tarball.  Presently, I get extra directories within which installed appears.

Could you give us a complete (minimal) example of what you get and
what you would expect?
With the "archive" generator like TGZ you may play with:

CPACK_INCLUDE_TOPLEVEL_DIRECTORY
CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY
in order to put/remove the toplevel directory in the archive.

e.g.
cpack -G TGZ -D CPACK_INCLUDE_TOPLEVEL_DIRECTORY=0

builtin doc:
cpack --help-variable CPACK_INCLUDE_TOPLEVEL_DIRECTORY
cpack --help-variable CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY
>
> Now suppose a user is using the NSIS installer.  They run the installer, which offers the default installation directory.  They choose a different directory.  When finished, the installer will have put installed, and everything within it, in the selected directory.

cpack --help-variable CPACK_PACKAGE_INSTALL_DIRECTORY
cpack --help-variable CPACK_PACKAGING_INSTALL_PREFIX
cpack --help-variable CPACK_NSIS_INSTALL_ROOT

> Is that clearer?  If so, what do I need to do to configure CPack?

If you have more question please give us a
non-working complete but minimal example to play with.

-- 
Erk
L'élection n'est pas la démocratie -- http://www.le-message.org


More information about the CMake mailing list