[CMake] CMake Java Support

Andreas Schneider asn at redhat.com
Tue Jan 11 06:38:09 EST 2011


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

-- 
Andreas Schneider                   GPG-ID: 8B7EB4B8
Red Hat                               asn at redhat.com
Samba Team                             asn at samba.org


More information about the CMake mailing list