[CMake] CPack Generator jar support

Eric Noulard eric.noulard at gmail.com
Thu Nov 10 02:17:01 EST 2011


2011/11/9 Alexander Broekhuis <a.broekhuis at gmail.com>:
> Hi Eric,
>>>
>>> By the way did you try the ZIP generator with
>>>
>>> set(CPACK_INSTALLED_DIRECTORIES "/path/to/META-INF;/META-INF")
>>>
>>> if some local (to the build) directory /path/to/META-INF contains
>>> the appropriate MANIFEST.MF and INDEX.LIST your jar should be built ok
>>> beside the fact it will have the zip extension.
>>
>> Does this guarantee that the meta-inf is located at the beginnen of the
>> zip file? Currently I use the CMake install functions to add files to a zip.
>
> I tried this, but my zip file is still the same. The files are there, but
> the MANIFEST isn't at the start of the file. Am I missing something how this
> should be used?

No you you probably don't.
I suspect that since CPACK_INSTALLED_DIRECTORIES were processed before
the classical "INSTALL" rules those files would be put at the start of the zip.

This seems to be wrong, sorry about that.

By the way did you suppress the INSTALL rule concerning the MANIFEST
you may have had before?

I bet the safest way to build your jar may be to craft the appropriate
'jar' whatever command
wrapped-up in a CMake custom command/target
(see add_custom_command add_custom_targt)
may be something that would

1) call cpack -G ZIP in order to have the clean zip file
2) jar xvf your_package.zip
3) jar cvf your_package.jar

or use any custom option for jar in step 3.

This is clearly doable with a CMake scripts.

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


More information about the CMake mailing list