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

Andreas Schneider asn at cryptomilk.org
Sat Dec 10 09:46:25 EST 2011


On Saturday 29 October 2011 23:34:50 Frank Glinka wrote:
> Hi,

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/36b223e34f5d48339da39e833a2f5e7d
> f2866e87

I don't like the way how it has been added here. I think it should be an 
optional vairable you set before like the others. Please open a feature 
request in the bug tracker. Patches are welcome.

> 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}

Should be an optional option and should be done like the other options.

set(CMAKE_JAVA_MANIFEST mymanifest.mf)
add_jar(foo foo.java)

> 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?

Open a feature request in the bugtracker.


	-- andreas

-- 
Andreas Schneider                   GPG-ID: F33E3FC6
www.cryptomilk.org                asn at cryptomilk.org



More information about the CMake mailing list