[Cmake] Why does ADD_JAVA_LIBRARY use "*.class" to build JAR files?

Andy Cedilnik andy.cedilnik at kitware.com
Mon Aug 30 17:34:18 EDT 2004


Hi Doug,

The Java mode was written long time ago and was never really updated.
With the changes Bill is adding, it will be much easier to support other
languages.

At that point, I will include my java parser, which finds proper
dependencies and we will be able to have native Java support.

			Andy

On Mon, 2004-08-30 at 17:00, Doug Gregor wrote:
> 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.




More information about the Cmake mailing list