[CMake] change where package is generated; full name of package with extension
Eric Noulard
eric.noulard at gmail.com
Fri Jun 18 12:30:25 EDT 2010
2010/6/18 Tyler Roscoe <tyler at cryptio.net>:
> 1. I want to change where "make package" deposits the packages it
> creates. Is there a way to do this -- some cpack variable I haven't
> found?
No variable I am aware of.
However you may create a custom target which call make package and then
move the file, provided you know the name of the generated file ....
>
> 2. I want to get a hold of the name (or names) of generated packages. I
> know the package will be called myproject.some_extension,
The name of the package file is
CPACK_PACKAGE_FILE_NAME+ extension.
If your CMakeLists.txt does not define CPACK_PACKAGE_FILE_NAME
then CPack will define it as:
${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}"
again if CPACK_PACKAGE_NAME is not defined
it is defined by CPack as PROJECT_NAME.
if you want to know more about "default" for unspecified values
I suggest you dive into CPack.cmake file.
> but how do I calculate "some_extension"? Is there some mapping between package type
> (TGZ, ZIP, NSIS) and the extension it ends up with (.tar.gz, .zip,
> .exe)?
Concerning the extension, it is fixed in the C++ code of the generator
in the GetOutputExtension method:
cmCPackDebGenerator.h: virtual const char* GetOutputExtension() {
return ".deb"; }
cmCPackGenerator.h: virtual const char* GetOutputExtension() { return
".cpack"; }
cmCPackNSISGenerator.h: virtual const char* GetOutputExtension() {
return ".exe"; }
cmCPackOSXX11Generator.h: virtual const char* GetOutputExtension() {
return ".dmg"; }
cmCPackPackageMakerGenerator.h: virtual const char*
GetOutputExtension() { return ".dmg"; }
cmCPackRPMGenerator.h: virtual const char* GetOutputExtension() {
return ".rpm"; }
cmCPackSTGZGenerator.h: virtual const char* GetOutputExtension() {
return ".sh"; }
cmCPackTarBZip2Generator.h: virtual const char* GetOutputExtension()
{ return ".tar.bz2"; }
cmCPackTarCompressGenerator.h: virtual const char*
GetOutputExtension() { return ".tar.Z"; }
cmCPackTGZGenerator.h: virtual const char* GetOutputExtension() {
return ".tar.gz"; }
cmCPackZIPGenerator.h: virtual const char* GetOutputExtension() {
return ".zip"; }
+ some other defined in .cxx files.
Note that currently every CPack generator only generates a single file
per project
but it may change depending of the issue of some open bugs:
see for example:
http://public.kitware.com/Bug/view.php?id=10736
and related bugs.
--
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
More information about the CMake
mailing list