[Cmake] Why does ADD_JAVA_LIBRARY use "*.class" to build JAR files?
Doug Gregor
dgregor at cs.indiana.edu
Mon Aug 30 17:00:48 EDT 2004
I'm attempting to build some Jar files like this:
ADD_JAVA_LIBRARY(bgl
edu/iu/osl/bgl/Graph.java
edu/iu/osl/bgl/GraphMLPersister.java)
The intent is to have the .class files stored in the Jar file to
reflect the package hierarchy (so the class edu.iu.osl.bgl.Graph is in
edu/iu/osl/bgl/Graph.class), as is common in Java. There are two
problems here:
1) ADD_JAVA_LIBRARY can't cope with the paths in several ways, most
importantly because it creates the Jar file from "*.class" instead of
the actual set of targets
2) Only the first file is actually compiled, because the macro doesn't
deal with a variable number of arguments
The attached patch (against CMake 2.0.3) fixes these problems, so that
the resulting Jar file has the right class files in the right places,
e.g.:
hoopy:~/Projects/parallel_bgl/IVC/build/src dgregor$ jar tf bgl.jar
META-INF/
META-INF/MANIFEST.MF
edu/iu/osl/bgl/Graph.class
edu/iu/osl/bgl/GraphMLPersister.class
I was a little surprised to see that CMAKE_JAVA_ARCHIVE and
CMAKE_JAVA_RUNTIME weren't marked as advanced options.
Doug
-------------- next part --------------
A non-text attachment was scrubbed...
Name: java_fixes.patch
Type: application/octet-stream
Size: 3706 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/cmake/attachments/20040830/0c9685b4/java_fixes.obj
More information about the Cmake
mailing list