Re: [CMake] Generating archives and binaries with different PREFIX settings using CPack

2011-04-25 Thread Eric Noulard
2011/4/25 Clifford Yapp cliffy...@gmail.com:
 I'm trying to generate both source tarballs and binary packages using
 CPack, and I'm at something of a loss as to how to achieve the
 following:

 I want the binaries (RPM, DEB, etc.) to respect the
 CMAKE_INSTALL_PREFIX.  I want the source tarballs to expand into their
 directory like a standard tarball, without any prefix directories.  As
 far as I can tell, both source and binary packaging structure is
 governed by CPACK_PACKAGING_INSTALL_PREFIX - am I missing something
 that will let me specify one setting for binary archives and another
 for source archives?
Nope your are not missing anything beside the fact that
there is nothing like a source generator known to cpack!!! :-(.

All generators do include a CPack Config file in order to configure
their behavior
so

package ==
   cpack --config ./CPackConfig.cmake

package_source ==
   cpack --config ./CPackSourceConfig.cmake

include(CPack) is generating this two config files using various
CPACK_xxx var values
but there is no such thing as a source generator.

e.g. CPack generator used for source or binary is the same generator
using a different config file.

 (Ideal would be per-generator settings, so I
 could generate a binary tar.gz bundle that would expand locally as
 well, but the really important one is source tarballs.)

per-generator settings is doable using CPack project config file:
http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#Overall_usage_.28common_to_all_generators.29

inside the CPack project file you should be able to guess whether if
CPack is running for a SOURCE package because the
CPACK_SOURCE_PACKAGE_FILE_NAME
is defined which shouldn't be  the case when packaging for binaries.

you may try with a CPack project file which could look like:

if(CPACK_GENERATOR MATCHES ZIP)
   if (CPACK_SOURCE_PACKAGE_FILE_NAME)
 set(CPACK_PACKAGING_INSTALL_PREFIX /SRC-ZIPprefix)
   else ()
 set(CPACK_PACKAGING_INSTALL_PREFIX /ZIPprefix)
   endif()
endif(CPACK_GENERATOR MATCHES ZIP)

if(CPACK_GENERATOR MATCHES RPM)
   set(CPACK_PACKAGING_INSTALL_PREFIX /RPMprefix)
endif(CPACK_GENERATOR MATCHES RPM)

if(CPACK_GENERATOR MATCHES DEB)
   set(CPACK_PACKAGING_INSTALL_PREFIX /DEBprefix)
endif(CPACK_GENERATOR MATCHES DEB)



if the toplevel dir you find in archive generators (TGZ, TBZ2, ZIP, ...)
is bothering you you can suppress it using:
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)

you can set this conditionnally in the CPack project file as well.

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Generating archives and binaries with different PREFIX settings using CPack

2011-04-25 Thread Clifford Yapp
Eric,

Thanks - that looks like it will do the trick, testing now.  Is there
a bug report somewhere proposing using CMake-level per-generator
variables to control these things?

Cheers,
CY
___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Generating archives and binaries with different PREFIX settings using CPack

2011-04-25 Thread Eric Noulard
2011/4/25 Clifford Yapp cliffy...@gmail.com:
 Eric,

 Thanks - that looks like it will do the trick, testing now.  Is there
 a bug report somewhere proposing using CMake-level per-generator
 variables to control these things?

AFAIK there aren't any.

Now adding this for ALL CPack generators would honestly be a pain
because you'll have to do it in EVERY generator...and redo it each time
you add/remove a CPACK_xxx generic var.

We may try to design something like CPack generator specific generic overload
which could be done by the CPack generator base class once for all.

Something like:
if CPACK_GEN_WHATEVER is defined then
CPACK_WHATEVER will automatically be overidden by
CPACK_GEN_WHATEVER content.


e.g.
set(CPACK_DEB_PACKAGING_INSTALL_PREFIX /opt)
would trigger
set(CPACK_PACKAGING_INSTALL_PREFIX /opt)

before DEB generator has a chance to run.
This is pretty much what is achieved with my example of CPack config
project file.

Note however that doing a lot of
set(CPACK_GEN_xxx ...) does not seems like a good idea to me.
Mixing CPack time informations with CMake time ones is not that nice.

I would rather suggest to continue to use the CPack config project file
with the set(CPACK_GEN_xxx ...) inside.


-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake