[CMake] Java support - install with components
Allen D Byrne
byrn at hdfgroup.org
Mon Dec 12 08:44:22 EST 2011
andreas,
Yes I agree the COMPONENT should be optional, but handled in the same manner as the install command - in fact if the function is to incorporate the INSTALL command then we must have a way to pass the same options to the INSTALL command that the INSTALL command supports. Maybe, we need to disect the INSTALL command?
I like the;
set(CMAKE_JAVA_MANIFEST mymanifest.mf)
option for manifests since they are more specific to java jar files.
>
> On Thursday 20 October 2011 11:59:05 Allen D Byrne wrote:
> > I've upgraded my Java project to the latest 2.8.6 release. The only thing
> > missing for me is to allow components on the install commands. I just did
> > the following:
>
> Hi Allen,
>
> > function(INSTALL_JAR _TARGET_NAME _DESTINATION _COMPONENT)
> > get_property(__FILES
> > TARGET
> > ${_TARGET_NAME}
> > PROPERTY
> > INSTALL_FILES
> > )
> >
> > if (__FILES)
> > install(
> > FILES
> > ${__FILES}
> > DESTINATION
> > ${_DESTINATION}
> > COMPONENT
> > ${_COMPONENT}
> > )
> > else (__FILES)
> > message(SEND_ERROR "The target ${_TARGET_NAME} is not known in this
> > scope.") endif (__FILES)
> > endfunction(INSTALL_JAR _TARGET_NAME _DESTINATION _COMPONENT)
>
> Sorry, this is not acceptable. If component should be added, it should be
> optional.
>
> Patches are welcome :)
>
>
> -- andreas
>
>
> > 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
>
> > I needed to change the UseJava.cmake script to allow INSTALL components and
> > to have more flexible locations for JAR resource files. In addition I
> > needed to change the java_copy_file function to use the execute_process
> > command. Attached is the diff for my changes, hoping the correct folks will
> > review.
>
> Hi Allen,
>
> sorry this patch is not acceptable. It needs to be optional or we break
> existing scripts. See find_jar() or create_javadoc().
>
>
> -- andreas
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20111212/00ac53b4/attachment-0001.htm>
More information about the CMake
mailing list