[CMake] CMake Java Support

luxInteg lux-integ at btconnect.com
Thu Jan 13 19:26:19 EST 2011


On Tuesday 11 January 2011 11:38:09 Andreas Schneider wrote:
> Hello CMake,
> 
> my name is Andreas Schneider and I'm working for Red Hat. At the end of
> last year I've worked on Dogtag PKI [1]. The Dogtag Certificate System [2]
> is an enterprise-class open source Certificate Authority.
> 
> The project is written in serveral different laguages (C, C++ and Java), so
> I've used CMake as the new build system. To be able to build the java
> project I needed Java support in CMake. So I've started to write functions
> to compile java files, find jar files, bundle jar files and generate
> javadoc.
> 
> It should provide everything to build java and jni projects. You find the
> files here:
> 
> http://git.cryptomilk.org/projects/cmake-tools.git/tree/language/java
> 
> 
> FindJNI.cmake:
> 
> 	Find JNI libraries and headers. I think this is the file from CMake
> 	itself.
> 
> FindJava.cmake:
> 
> 	Find all needed Java tools like javac, javadoc, jar, etc.
> 
> UseJava.cmake:
> 
> 	This file provides all needed function to support creating java
> 	projects in CMake. Most of the function are documented in detail.
> 	There is some documentation missing. I will add this soon.
> 
> UseJavaClassFilelist.cmake:
> 
> 	This is needed to find the class files in the build directory. One
> 	.java file can create multiple .class files. So you have to glob for
> 	these file. There is support to only look for certain .class files.
> 
> UseJavaSymlinks.cmake:
> 
> 	This is a helper to create symlinks for versioned jar files.
> 
> 
> git clone git://git.cryptomilk.org/projects/cmake-tools.git
> 
> 
> It would be nice if this would be included into the CMake distribution, but
> at the moment there is still documentation missing. I hope that this will
> help some people to get their Java project built with CMake.
> 
> Comments, suggestions and patches are welcome!
> 
> Best regards,
> 
> 
> 	-- andreas
> 
> 
> [1] https://fedorahosted.org/pki/browser/trunk/pki
> [2] http://pki.fedoraproject.org/wiki/PKI_Main_Page

As a complete novice at this cmake stuff, I read with interest   the files 
within your link and your post also.   I have dabbled with java   and have a 
little interest in  dabbling with openJDK.
But I know of no recipe for building openJDK  (there used to be one   at   
( http://cblfs.cross-lfs.org/index.php/OpenJDK    ) but no more.    And this 
site  (  http://openjdk.java.net/ )   is not particularly helpful; .  
Have you tried building openJDK with  cmake?  Or do you know of anyone who 
has? Or would you like to give  your java/c{c++}/cmake-macros a test run   and 
let us stand on your shoulders?



More information about the CMake mailing list