[CMake] [Java] - Adding manifest information to a jar file

Frank Glinka glinkaf at uni-muenster.de
Sat Oct 29 17:34:50 EDT 2011


Hi,

I am happy about the recently improved Java support within cmake. 
Thanks! Anyhow, I have a small point which should be easy to improve and 
which would deliver quite some usability, in my opinion.

The current syntax for building and packaging Java files is:

> add_jar(${TARGETNAME} ${SOURCE_FILES} ${RESOURCE_FILES})

This has some drawbacks:

1) No executable jar can be created with that method. It seems there is 
already some effort on that issue as: 
https://github.com/viandfraich/CMake/commit/36b223e34f5d48339da39e833a2f5e7df2866e87

2) A jar file can be annotated with a lot of more important information, 
e.g., version information, scope, main-class (would also catch the first 
issue), etc. This information is normally passed as a property/manifest 
file when calling the "jar" packager. Currently, the UseJava.cmake 
module creates the following command within 'add_jar':

> jar cf ${TARGETNAME} ${CLASS_FILES} ${RESOURCE_FILES}

The following would solve my (and I guess many others') use cases:

> jar cmf ${TARGETNAME} MyManifest.mf ${CLASS_FILES} ${RESOURCE_FILES}

An optional command to add_jar would be desirable which allows to 
provide an optional manifest file. If provided, the later syntax should 
be used for calling the 'jar' tool.

Will there be progress towards supporting manifest information anytime 
soon within cmake?

Regards,
Frank



P.S. More information on manifest files can be found, e.g., here: 
http://download.oracle.com/javase/tutorial/deployment/jar/manifestindex.html


More information about the CMake mailing list