[CMake] CMake Java Support

Andrea Galeazzi Galeazzi at korg.it
Tue Jan 11 10:01:14 EST 2011


Andreas Schneider ha scritto:
> 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
>
>   
Hi Andreas,
I'm a dyed-in-the-wool Java developer (and also Fedora user) so it makes 
me very happy to know that someone are working to integrate Java in 
CMake. My question is: shouldn't Ant be enough? Or better, Could 
invoking an Ant file as pre/post build command in CMakeLists always 
accomplish any kind of build requirement?



More information about the CMake mailing list